0

I have a page with a form where user have to fill inputs, their login are filled automatically in hidden input, and I have a user with a login with a special character (in my case the character is é). And when the form is submitted the special character turns into the symbol é. Here is what I have :

FORM

<input type="hidden" name="Employe" value="<%= employe %>">

when I inspect the element I can see that the value is rémax

And when I do this

String employe = request.getParameter("Employe");
System.out.println(employe);

The output is rémax

This not seems to be an issue with charset because I can display special characters in both views. Why the special character is not displayed as expected ?

Simon M.
  • 2,244
  • 3
  • 17
  • 34

1 Answers1

0

Try adding <?xml version="1.0" encoding="UTF-8"?> to the very start of the page.

If that doesn't work you might try the following:

  1. It's a GET request and the server isn't configured to use UTF-8 to parse request URI. If you are using Tomcat then set URIEncoding attribute of the HTTP Connector in /conf/server.xml to UTF-8.
  2. If it's a POST request, then you need to ensure that the servletcontainer uses UTF-8 to encode the request body. You can do that by request.setCharacterEncoding("UTF-8") beforehand.
Zeeshan
  • 11,851
  • 21
  • 73
  • 98
  • None of these solutions worked and it's a `GET`request – Simon M. May 27 '16 at 12:51
  • Maybe your browser is unable to auto-detect `UTF-8` encoding which java defaults to. Try to force character encoding to `ISO-8859-1` using `request.setCharacterEncoding("ISO-8859-1")` – Zeeshan May 27 '16 at 12:55