Re: what should the charset be in the response to the server

At 10:41 03/07/28 -0600, Shigemichi Yazawa wrote:

>I entered a Japanese text and got the same result. No content-type
>header.  Mozilla 1.4 (for Windows) doesn't put it either.
>
>I setup a JSP here. Feel free to try this out yourself.
>
>http://www.runout.org/html-form-test/multi-part-form.jsp

Currently, that gives a 500 internal server error. Maybe you
already disabled it?


>I also setup another JSP that adds accept-charset="UTF-8" in FORM
>element as Chris suggested.
>
>http://www.runout.org/html-form-test/accept-charset.jsp

(same 500 here)

>It seems to work fine even if you change the character encoding in
>your browser. This seems to be a effective solution for immediate
>needs.

I think it is a good idea to both say accept-charset="UTF-8" in
the FORM element AND make sure the page is sent out as UTF-8
(and check that the data is UTF-8 when it comes back).
The reason for this is that support for accept-charset on the
FORM element has picked up only recently; some fairly new
browsers may not honor it.


>Even using this technique, you still have to do this old trick.
>
>   new String(request.getParameter("param").getBytes("ISO8859_1"), "UTF-8");

Using
     request.setCharacterEncoding("UTF-8");
     request.getParameter("param");
didn't work last time I tried. Maybe I'll try again.


Regards,    Martin.

Received on Thursday, 7 August 2003 11:46:50 UTC