-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

On 7/8/2009 12:14 PM, André Warnier wrote:
> 2) find out the available "locales" on the Linux host where you run this
> Tomcat.
> "locale -a | more"
> Pick one locale that has "utf8" in the name, note its name.
> In the system script that starts Tomcat, add
> export LC_ALL="pt_pt.u...@euro"
> (or whichever locale you have chosen)
> That sets the "system locale" for the JVM that runs Tomcat, and is a way
> to make it independent from whatever may be the system's configured
> "default locale".

This shouldn't really matter: the default locale for the JVM does not
affect the encoding used for reading request URIs and bodies: the body
is always decoded using the Content-Type request header (or ISO-8859-1
if none is provided) and the URI is always decoded using ISO-8859-1
unless you have overridden it using the appropriate <Connector> attribute.

Reading files off the disk /is/ usually done using the default encoding.
I haven't read the spec wrt JSP files, but I would hesitate to use any
non-ASCII characters in these files - just like you should when saving
.java files. Any non-ASCII characters can be expressed using \uxxxx
syntax. Another poster mentioned using native2ascii with .properties
files, which can be used for this purpose as well.

> 3) All your html pages should have a declaration like :
> <meta http-equiv="content-type" value="text/html; charset=UTF-8" />

This is debatable :)

> 10) If you want to really make sure, include in all your forms some
> hidden input value, containing a known string with "accented" characters
> (áàéèÜÖ and such).

Since you mentioned that you had done this at some point, I've been
thinking about a way to do this in an automated way, so you could sort
of "turn it on" for your entire site. I think the only way to wave a
magic wand and have this work is if you were already using some kind of
custom <xyz:form> JSP tag library, and you were to subclass and replace
the class that implements the <xyz:form> tag to add a hidden <input>
parameter. A corresponding Filter would need to be written to check for
the proper decoding of the GET parameter, but this could be used
site-wide with no further invasiveness. (Of course, using <xyz:form> is
probably relatively invasive unless you are already using a tag library
such as Struts's).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkpY7OQACgkQ9CaO5/Lv0PA63wCfbqpsFootgsI6Ok5KSndiYJsT
97cAoIJz97sXME1IZL90execVYaISf5B
=mrSL
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to