"Otto, Frank" <otto 'at' delta-barth.de> writes:

> Hi,
> 
> I have a html form. The user can input text in ISO-8859-2 format. 
> 
> After submit the form the characters are wrong.  I don't know why.
> 
> I have set 
> 
> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
> 
> and there is a filter (filters.SetCharacterEncodingFilter) to encode UTF-8.
> 
> How can I convert the polish character, which the user has inputed?

The problem is, in which encoding the browser is sending the
data, and is it telling so (e.g. does the server has a way to
know the encoding of the data it's receiving).

Theoretically, when sending HTTP POST, browsers should put the
charset= parameter in Content-Type and everything should be fine
if the receiving server decodes that correctly. But, as far as I
know, once, Mozilla tried to put the charset in Content-Type:
field when replying with HTTP POST but had to remove this because
it broke too many existing servers with bad configurations.
However, I can't find the bug in their bugzilla again.

The problem is worse with HTTP GET where there is really nothing
to tell the encoding of the parameters passed.

As far as I know, the most reliable way is to specify
"accept-charset" as UTF-8 in the <form> of the HTML (w3.org's
description of this parameter: "This attribute specifies the list
of character encodings for input data that is accepted by the
server processing this form"). Theoretically, this forces the
browser to send the data in UTF-8. As far as I know, tests showed
that this should work correctly with current browsers. The
problem is that this parameter is not available in <html:form>
from struts, the reason of it I have no clue about.

Something you can try it to specify the encoding of the html page
in which you have your form as UTF-8, it seems that mozilla will
send GET/POST parameters in UTF-8 in such a case, but that's
really a hack and I don't know browser support about it.


And of course, on-the-fly detection of the charset is not
reliable at all :).

-- 
Guillaume Cottenceau

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to