Laurent <lg83news 'at' free.fr> writes:

> Nicolas De Loof wrote:
> > Can someone explain me what's wrong in HTTP / servlet API about char
> > encoding :
> > I'm using <html:link> to build a link with parameters, whose values
> > use french chars ('é', 'à' ...)
> > I need to set useLocaleEncoding to get values in my servlet (that is
> > not a struts action) using getParameterMap.
> > If I do not set this attribute, I get values with strange strings
> > that looks like UTF-8 sequences.
> > Is they're no strict standard for URI encoding ? Is tomcat servlet
> > API wrong about this ?
> 
> I don't know about the specific behaviour of tomcat, but the answer to
> the first question is No: the only standard is us-ascii. If a browser

Do you have any evidence, the HTTP RFC or something else?

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html
makes me think that tomcat uses ISO-8859-1 by default, not
US-ASCII.

> needs to send characters that are outside us-ascii, it will always
> encode them in the same encoding as the page that contains the link /
> form.

"Always" seems a bit too definitive to me. When present, the
accept-charset attribute of the form element would make this
behaviour different.

> If you are doing this on the server side, just make sure you do
> the necessary encoding/decoding while sending and receiving so that it
> works!

What are you talking about, more precisely? As far as I know,
there is no explicit encoding/decoding when using tomcat. The
results of HttpServletRequest#getParameter is a String, not an
array of bytes, therefore it has already been decoded by tomcat
(HttpServletRequest#getCharacterEncoding can show which encoding
was used).

-- 
Guillaume Cottenceau

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

Reply via email to