users@glassfish.java.net

Re: Glassfish International characters

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Tue, 27 Jan 2009 18:56:15 -0800

On 01/27/09 12:51, glassfish_at_javadesktop.org wrote:
> I have a PHP client applications that talks to the java web layer code(servlet) deployed on Glassfish. Whenever a user enters some data in say chinese and submits the form, the data shows up as garbled characters in the servlet. The PHP layer is encoding the data in UTF-8, so I'm suspecting that some setting has to be changed on Glassfish for it to understand UTF-8 characters. I'm not sure what to do. I would be grateful to any suggestions.
>

Since you already know that the request is encoded in UTF-8, you need to
pass UTF-8
to ServletRequest#setCharacterEncoding before you start reading any
request data.
Otherwise, the default encoding ("ISO-8859-1") would be used.

GlassFish also allows you to configure the request encoding in your
sun-web.xml, and
to declare the name of a hidden FORM field whose value will specify the
request encoding.
Let me know if you need more info about these options.

Thanks,

Jan


> [Message sent by forum member 'srinisub' (srinisub)]
>
> http://forums.java.net/jive/thread.jspa?messageID=328476
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
webtier_at_glassfish.dev.java.net