portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aurelien Pernoud" <apern...@sopragroup.com>
Subject RE: possible character encoding bug
Date Thu, 22 May 2003 16:36:59 GMT

Joachim Müller a écrit :

> wow, this sounds like a lot of hassel...
>
> maybe I was a bit too quick, but the problem resolved by
> changing the encoding in media.xreg from UTF8 to 8859_1.
> this works for me, because I only use german and english.
> (quicktest: mozilla 1.3, IE6, winxp)
>
> I am using tomcat4.1.18 and request.getCharacterEnconding returns
> null correctly.
>
> but again. isn't it dangerous to hard code the string_to_bytearray
> conversion with 8859_1, not knowing what character encoding the
> request was send with?

In fact when entering in the media the encoding utf-8, it sets the response
header to use utf-8.
Else it uses the defaut encoding (from js.pr),
and finally, if it's here, it uses the request.getCharEncoding

Everything is done in the setRequest method to determine what was the
request encoding, based on what was the previous response :)

If nothing is found, it uses ISO8859-1 to decode and then to recode it, so
nothing happens, that's just your case :)

To really understand the trouble, try doing a servlet that set response
encoding to utf-8, with a form that has parameter to send back, and then in
the DoPost method try to read it directly (request.getParameter("x")),
you'll see the character is decoded as iso8859-1 instead of utf-8. When
using "normal" chars it's ok, when using accents, euro symbol or other...
that sucks.

So you'll have to do the conversion again in the other way, that's what is
done in this part in fact.

Aurelien


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message