users@glassfish.java.net

Re: encoding still not working :(

From: BJörn Lindqvist <bjourne_at_gmail.com>
Date: Mon, 23 Mar 2009 14:04:14 +0100

2009/3/19 Jan Luehe <Jan.Luehe_at_sun.com>:
> The solution, which forces the browser to submit forms in UTF-8, is to
> use the following jsp tag:
>
> <%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
>
>
> Exactly!
>
> It would be more convenient if there was a domain setting to set the
> default HTTP Content-Type header to UTF-8, but there doesn't seem to
> be any.
>
>
> Correct, there is no domain setting for this, because each webapp is
> different.
> However, you could declare the above page directive in a JSP prelude (which
> in
> turn would have to be declared in your web.xml), in order to avoid having to
> declare it on each and every of your JSPs.

I tried this, and it should work correctly, except that that config
easily conflicts with the pageEncoding attribute on individual pages.
For example, if you configure the encoding to be "UTF-8" in web.xml,
and then also have pageEncoding="utf-8" in JSP headers, then glassfish
flips out because "UTF-8" != "utf-8" and thinks that they declare
different encodings. It is totally braindead and a bug in glassfish.


-- 
mvh Björn