But to do
byte[ ]b = request.getParameter( "MyParam" ).getBytes(
"UTF-8" );
you must know the charset encoding of the form paramaters (utf-8 in this
case) which leads us to original question.
Edson Alves Pereira wrote:
> Then, you could create a class that would convert strings from some
>encoding that you don�t known and transform to UTF-8 and that class load its
>configuration from a local .properties file to make it flexible, for
>example:
>
> public String getParameter( String stName_ )
> {
> //This will change the native encoding to you favorite one:
> byte[ ]b = request.getParameter( "MyParam" ).getBytes(
>"UTF-8" );
>
> return new String( b ); //To use default encoding:
> return new String( b, "UTF-8" ); //Some different:
> }
>
>
>
>
>>----------
>>De: Daniel H A Lima[SMTP:lima@(protected)]
>>Responder: Tomcat Users List
>>Enviada: quinta-feira, 9 de outubro de 2003 11:11
>>Para: Tomcat Users List
>>Assunto: Re: Charset encoding issue (again :-))
>>
>>But with this approach, all web apps running under the same JVM will use
>>this encoding. We want to avoid this...
>>
>>Edson Alves Pereira wrote:
>>
>>
>>
>>> The best way to solve that is to set -Dfile.encoding=ISO-8859-1 in
>>>JAVA_OPTS, with this you ensure that your JVM is using the encoding that
>>>
>>>
>>you
>>
>>
>>>want.
>>>
>>>
>>>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)