Glassfish encoding
Solution 1
Glassfish uses ISO-8859-1 encoding by default. See http://download.oracle.com/docs/cd/E19798-01/821-1752/beafu/index.html for more information.
Solution 2
Have you tried using glassfish-web.xml
instead of sun-web.xml
?
To change default Glassfish POST fields encoding, I put this to WEB-INF/glassfish-web.xml
, and it worked (I use glassfish 3.1.2):
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD
GlassFish Application Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<parameter-encoding default-charset="UTF-8" />
</glassfish-web-app>
I'm not sure if it will help you, but may help other people having the same problem as me.
Argiropoulos Stavros
I'm a web developer from Greece. Check me out! Newest stack overflow answers by me
Updated on August 12, 2022Comments
-
Argiropoulos Stavros almost 2 years
I'm using the code in this example example and in the runUpdate() function which i put in a javabean in a web application in Netbeans 6.8 with Glassfish v3. It seems i have an encoding problem because question marks appear in the table.
I have tried so far:
- In nbproject->private->private.properties add runtime.encoding=UTF-8>
- In project->properties->sources->encoding utf-8
- In program files->netbeans->etc->netbeans_conf in netbeans_default_options i add -J-DFile.encoding=UTF-8
- In project->properties->build->compiling->additional compiler options -encoding utf-8
- In sun-web.xml i added
<locale-charset-info default-locale="UTF-8"> <locale-charset-map locale="" charset=""/> <parameter-encoding default-charset="UTF-8"/> </locale-charset-info>
Also when i use system.out.print() in the glassfish output panel i get gibberish. I'm in the last level of madness please take a look. Thank you.
EDIT Also when i do listing .5 i get a glassfish error:
WARNING: WEB0500: default-locale attribute of locale-charset-info element is being ignored
-
Argiropoulos Stavros over 14 yearsThank you for your answer. I use the example code to input data in a table in fusion tables. Please look at the following link tables.googlelabs.com/DataSource?dsrcid=136056 If i use their ui it's ok(all entries in the table except the last one) and if i use the api i get the last entrie of the table which is corrupted.Yes my browser is in utf-8.And all the sources have encoding utf-8
-
TheSteve0 over 14 yearsBizarre - I really hated working with different encodings. If you delete the last row does the new last row get messed up? If not then perhaps your last row is really not in UTF-8.
-
Al-Mothafar over 12 yearsBy default all modern browser uses UTF-8 as default encoding if not defined on page, and I have an issue now encoding issue caused by Glassfish, no problem with tomcat, but in glassfish.