tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel H A Lima <l...@cit.com.br>
Subject Re: Charset encoding issue (again :-))
Date Thu, 09 Oct 2003 14:29:56 GMT
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@cit.com.br]
>>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@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message