I'm currently working on enabling an application for Asian language support.
The application is already supports multiple W.European languages.  It uses
the JSTL fmt tags for most, but not all, screens.  To support the Asian
languages, we've decided to use the UTF-8 charset for all pages so we can
always use the same charset when decoding request parameters regardless of
what language the user is submitting the data in.
 
I put together a prototype with a JSP page that set the contentType to
"text/html; charset=utf-8" and then displayed the contents of a Japanese
locale resource bundle.  When running this test, I noticed that the charset
was overridden to be Shift_JIS.  This causes problems since now any forms
submitted from that page will be sent via Shift_JIS encoding, and since I'm
expecting UTF-8, the screen fails.  I know from reading the specification
that using the various fmt tags will result in the response.setLocale()
method being called, which will then additionally set the charset.  

The question I have is: why do the fmt tags automatically call setLocale for
you?  I can understand the <fmt:setLocale /> tag doing it, but I'm trying to
understand why <fmt:setBundle /> and <fmt:message /> set the response Locale
as well, since that overrides any other charset that may have been
explicitly requested by the JSP developer when using a page directive to set
the charset explicitly.

To work around this, I have implemented a ServletFIlter that passes a custom
response wrapper along the filter chain.  The custom response object
prevents the charset from being set to anything other than UTF-8.  This
seems like a reasonable solution, especially since our application needs to
support multiple application servers.

Are there there any other better ways to guarantee that the UTF-8 charset
will be used for my JSP pages regardless of the JSTL tags attempting to set
the Locale/charset automatically?

Thanks for any info,
Robb
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to