users@glassfish.java.net

Re: why the default response character encoding must be ISO-8859-1?

From: Ken--_at_newsgroupstats.hk <dragonken_at_gmail.com>
Date: Wed, 18 Mar 2009 07:37:28 -0700 (PDT)

Dear,

Is that character encoding for request? What I am talking is encoding of
response. Am I correct?

Please find attached jsps. utf8-test1.jsp and utf8-test2.jsp.

http://www.nabble.com/file/p22579795/utf8-test1.jsp utf8-test1.jsp
http://www.nabble.com/file/p22579795/utf8-test2.jsp utf8-test2.jsp

utf8-test1.jsp is working with tomcat only, gf3 will show distorted words.
The page encoding of utf8-test1.jsp under gf3 is ISO-8859-1. utf8-test2.jsp
are working with gf3 and tomcat6.

my webapps contents are latin encoding. In order to work with gf3, I have to
convert all content encoding to utf-8:

str = new String(str.getBytes("iso-8859-1"), "utf-8");

I got this problem when I was using tomcat 5.0.28. Here is the change log of
tomcat5.0:

http://web.archive.org/web/20071012233252/http://tomcat.apache.org/tomcat-5.0-doc/changelog.html

If ServletResponse.getWriter() is called and no char encoding has been
specified, set response char encoding to default (ISO-8859-1) so that it is
reflected in getContentType() and Content-Type header, as required by the
Servlet Spec (Bugtraq 6152759) (luehe)

I did ask tomcat team and they replied that they just follow servlet spec
2.0.

The problem is gone in Tomcat 6.0. (I didn't try tomcat 5.5).

Today, I have to migrate my webapps from tomcat6 to gf3. Please advise any
config or setting can solve the problem without convert all content to utf8.

Regards,
Ken




Felipe Gaucho wrote:
>
> fro Glassfish, the following steps are used to set the encoding:
>
> * The getCharacterEncoding() method
> * A hidden field in the form, specified by the
> form-hint-field attribute of the parameter-encoding element in the
> sun-web.xml file
> * The default-charset attribute of the parameter-encoding
> element in the sun-web.xml file
> * The default, which is ISO-8859-1
>
> On Tue, Mar 17, 2009 at 5:27 PM, Ken--_at_newsgroupstats.hk
> <dragonken_at_gmail.com> wrote:
>>
>> I am trying to migrate my webapps from tomcat 6.0 to glassfish v3... but
>> I
>> found the my utf-8 pages are not working well with gf3.
>>
>> my jsps like this:
>>
>> <%_at_page contentType="text/html"%>
>> <html>
>> <head>
>> <META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=utf-8">
>> <title>...</title>
>> </head>
>> <body>
>> content
>> </body>
>> </html>
>>
>> Those pages are working well with apache + tomcat 6.0 but with gf3,
>> Chinese
>> characters are distorted and I have to right click and manually adjust
>> the
>> Encoding to Unicode (UTF-8) to display Chinese words correctly. I checked
>> that the page encoding was somehow adjusted to iso-8859-1.
>>
>> I remember that exactly same problem was happened with tomcat 5.0.28.
>>
>> Any idea?
>>
>> Ken
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/why-the-default-response-character-encoding-must-be-ISO-8859-1--tp22562986p22562986.html
>> Sent from the java.net - glassfish users mailing list archive at
>> Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>
>
>
> --
>
> Please help to test this application:
> http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>

-- 
View this message in context: http://www.nabble.com/why-the-default-response-character-encoding-must-be-ISO-8859-1--tp22562986p22579795.html
Sent from the java.net - glassfish users mailing list archive at Nabble.com.