1

I have a page where username will be retrieved from a db and displayed in a jsp page. This username contains a French character é and is displayed fine. But when I submit the user details form in the jsp, this character is converted to é in my servlet. I have put alerts in javascript and saw that the value is correct before form submission, so I suspect that something went wrong in between the form submission and value retrieval.

Jérôme Beau
  • 10,608
  • 5
  • 48
  • 52

2 Answers2

1

This is a typical case where you try to convert UTF-8 content into ISO-8859-1 as you can see with this simple code:

System.out.println(new String("é".getBytes("UTF-8"), "ISO-8859-1"));

Output:

é

Make sure that you used UTF-8 everywhere

Nicolas Filotto
  • 43,537
  • 11
  • 94
  • 122
0

You need to specify the encoding to be the same as the submitted one. This will most likely be utf8. Should this be the case already check your server's locale settings for encoding as well.

Arphylion
  • 38
  • 1
  • 6