Set request character encoding of JSF input submitted values to UTF-8 in GlassFish
Asked Answered
V

1

7

I have a problem with the values inserted in all my <h:inputText> fields. Some characters are not encoded in the right way. E.g. if I put ciò in the input field I get ciò.

How can I allow a user to insert text with those characters and save them correctly? The problem in not in the DB encoding since I already have the wrong value before inserting it in the DB.

I'm using JSF 2 with Facelets and GlassFish as application server.

Velodrome answered 13/3, 2012 at 10:41 Comment(0)
A
14

You need to tell Glassfish to use UTF-8 to decode paramters instead of (default) ISO 8859-1. Add the following entry to the <glassfish-web-app> of your /WEB-INF/glassfish-web.xml file:

<parameter-encoding default-charset="UTF-8" />
Avram answered 13/3, 2012 at 10:49 Comment(2)
I have the same problem on jboss 7, any idea how to set the encoding on jboss?Bisulcate
@dov.amir: #17628854Avram

© 2022 - 2024 — McMap. All rights reserved.