On 03/18/09 09:20 AM, BJÃ¶rn Lindqvist wrote:
> 2009/3/17 Wolfram Rittmeyer :
>> Actually internationalization on the web is a big mess. E.g.: AFAIK all
>> browsers use the encoding of the page (META-html tag) when creating a URL
>> for GET requests after submitting a form - even though the W3C and rfc2718
>> state to always use UTF-8. Also it is unfortunate that the servlet spec
>> defaults to ISO-8859-1.
> That is not entirely true. Glassfish, by default, sets the
> Content-Type charset header to ISO-8859-1
See my reply to Ken ("Re: why the default response character encoding
must be ISO-8859-1?"),
sent to the users@glassfish alias, for the motivation behind this, and
why the Servlet 2.5 actually
requires this behaviour.
> which causes browsers to
> send data in ISO-8859-1 encoding even if you specify another encoding
> in the meta tag. So the browser submits ISO-8859-1 strings which the
> server erroneously believes is UTF-8 if you have set
for example. Then when
> the server tries to display that data, it encodes it as UTF-8 which
> produces garbled strings because they are still in ISO-8859-1.
> 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" %>
> 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
However, you could declare the above page directive in a JSP prelude
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.
Hope this help.
>> Thus no matter what the wiki page says, the issue will remain confusing.
>> Nevertheless I guess the page could be improved. Maybe I can suggest s.th.
> That wiki page deals only with request encodings. That is, how the
> glassfish server interprets strings coming from the user, not the
> encoding of the strings it sends to the user.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.