In <fmt:message key=".."/> the class ...tag.common.fmt.SetLocaleSupport's method setResponseLocale() is called after fetching the localizationContext and before getting the bundle.

In setResponseLocale(), the response's locale is set via response.setLocale(). This method according to the API also:

"Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate"

thus overwriting what I set with my JSP page contentType= directive.

Would this a bug in Sun's implementation, a bug in MessageTag, or not a bug at all?

I see it as a problem because I cannot control what ServletResponse.setLocale() does to the http headers. A locale is ignorant of the character encoding, so it seems strange taht calling this method should affect the http character encoding header.

I see there's an entry in bugzilla already from a couple of weeks ago:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23125





On 09/28/2003 05:54 PM Adam Hardy wrote:
I'm trying to set my pages to UTF-8. I am setting my page directive with:

<% page contentType="text/html; charset=UTF-8" %>

and so long as I don't use the JSTL fmt taglibs, it works. When I put in something like <fmt:message key="general.browserTitle" /> then UTF-8 is overridden and response content type is set to ISO-8859-1.

On digging around I can't really see obviously in the source when the response.setContentType is called, but I can see that the sessions are getting this attribute set:

javax.servlet.jsp.jstl.fmt.request.charset==ISO-8859-1

although it doesn't seem to be the cause, just another symptom. I have tried <fmt:requestEncoding value="UTF-8" /> with no success.

I am using a filter in tomcat to set the request encoding anyway, and this is always UTF-8.

I'd appreciate any help on this, I've must have spent about 6 hours trying to nail this glitch.

Thanks
Adam


-- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9


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



Reply via email to