Christopher Schultz a ??crit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Frederic,
>
> Frederic Bastian wrote:
>
>> Christopher Schultz a ??crit :
>>
>>> You want to do this:
>>>
>>>
java.net.URLEncoder.encode(myParam,
>>> request.getCharacterEncoding());
>>>
>>>
>> This does not work :) request.getCharacterEncoding() is different
>> from <Connector> URIEncoding. The request character encoding
>> determines in which character encoding the parameters value will be
>> return to you.
>>
>
> My mistake. I meant response.getCharacterEncoding().
>
>
>> But it doesn't determine in wich character encoding the URI has to be
>> read.
>>
>
> But you aren't reading a URI. You're writing one. I'm assuming that you
> want to encode a URI for output into a web page. The web page ought to
> be written using the response's encoding, not the URIEncoding.
>
I'm sorry but I think you don't get it :) Reading and writing URI is
totally different from writing the response output. For instance, you
can set the response character encoding to UTF-8 in order to display
your html in UTF-8, and set the Connector URIEncoding to ISO-8859-1 to
read URI in ISO-8859-1 (and so, you have to encode your URI in ISO-8859-1).
For instance, If you want to make a redirection, you just send a
redirection header, there is no response output writing, so no matter
wich character encoding your web pages are displayed in.
The point is that the character encoding of the <Connector> URIEncoding,
and the character encoding of the URLEncoder method, have to be consistent.
Make the try : set the response character encoding to UTF-8, set the
URLEncoder character encoding to UTF-8, generate a web page including
links with encoded parameters with special chars, and follow these
links. You will see that the server does not interpret correctly the
parameters, because the <Connector> URIEncoding is still set to ISO-8859-1.
So, for portability purpose, I'd like to make the character encoding of
the <Connector> and of the URLEncoder consistent, without modifying the
server.xml file. But it looks pretty impossible :p
>
>> What's the problem with URLEncoder ? I don't get you :)
>>
>
> Nothing. All the things I mentioned used them at the heart (or should).
> They just take out the guesswork of which encoding you should be using,
> and when to apply it.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGqQJ29CaO5/Lv0PARAuhvAJ9vmHBfszi95wQyVlV2o36yZ4N8SQCfTqKN
> puaAISUt3/OrGna00/8dvk4=
> =B73f
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@(protected)
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)