You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Ramachandiran, Jagan Mohan [OCDUS Non J&J]" <JR...@its.jnj.com> on 2010/04/12 20:45:08 UTC
Tomcat and UTF-8
Hi,
Recently we migrated from Weblogic to Tomcat 5.5.28. After the migration
we had issues in viewing special characters in UI, we updated UTF-8
encoding settings to web.xml and in TOMCATINSTALLDIR/conf/server.xml
added the URIEncoding parameter to the connector.
Web.xml settings
<filter>
<filter-name>Character Encoding</filter-name>
<filter-class>com.matrixone.servlet.SetCharacterEncodingFilter</filter-c
lass>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Character Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Even after adding these setting, we are not able to see the old data
properly. We are seeing junk characters instead of seeing the actual
characters.
So my questions:
1) Will tomcat properly display the characters that were stored prior to
the migration? New data is displaying properly.
2) Are some other settings required to view the old data without seeing
some junk characters?
Thanks in advance for the response.
Regards,
Jagan
Re: Tomcat and UTF-8
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jagan,
On 4/12/2010 2:45 PM, Ramachandiran, Jagan Mohan [OCDUS Non J&J] wrote:
> Recently we migrated from Weblogic to Tomcat 5.5.28. After the migration
> we had issues in viewing special characters in UI, we updated UTF-8
> encoding settings to web.xml and in TOMCATINSTALLDIR/conf/server.xml
> added the URIEncoding parameter to the connector.
Please be specific: what encoding settings did you change in web.xml and
how have you configured your <Connector>?
> Web.xml settings
> <filter>
> <filter-name>Character Encoding</filter-name>
> <filter-class>com.matrixone.servlet.SetCharacterEncodingFilter</filter-class>
> <init-param>
> <param-name>encoding</param-name>
> <param-value>UTF-8</param-value>
> </init-param>
> </filter>
> <filter-mapping>
> <filter-name>Character Encoding</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
Note that this (probably) sets the default character encoding for
incoming request bodies.
> Even after adding these setting, we are not able to see the old data
> properly. We are seeing junk characters instead of seeing the actual
> characters.
The above filter does not change anything about the output of your
webapp: it only changes the way request bodies are interpreted.
> So my questions:
>
> 1) Will tomcat properly display the characters that were stored prior to
> the migration? New data is displaying properly.
Tomcat pretty much just moves bytes around. As long as your webapp does
not cross-code any text, everything should be fine. Is your database
configured to store data in UTF-8? Is your JDBC driver configured to
speak UTF-8? How about your JSPs, etc.: are they configured to emit text
in UTF-8 encoding?
> 2) Are some other settings required to view the old data without seeing
> some junk characters?
You must have changed something else to make your old data look broken.
You should read this:
http://wiki.apache.org/tomcat/FAQ/CharacterEncoding
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkvDbCIACgkQ9CaO5/Lv0PATKACeMoa158cCfJtrcde7lCpZPhpc
AfoAn1uvWXYfh0iIqKd4MAHseERz8gKx
=ydNY
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org