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.

> ----------
> De:   Daniel H A Lima[SMTP:[EMAIL PROTECTED]
> Responder:    Tomcat Users List
> Enviada:      quinta-feira, 9 de outubro de 2003 10:45
> Para:         Tomcat Users List
> Assunto:      Charset encoding issue (again :-))
> 
>     Hi, everybody. I've some doubts about html form charset encoding. I 
> will be glad if someone could answer questions above.
> 
> 1 ) We have jsp files with directive <%@ page language="java" 
> pageEncoding="utf-8" contentType="text/html;charset=utf-8" %>
> and some classes with the following working code :
> 
>     if ( request.getEncoding() == null ) {
>           String s = request.getParameter( "some_param" );
>           byte [] b = s.getBytes( "iso-8859-1");
>           s = new String( b, "utf-8" );
>     }
> 
>   a) Will it work for any charset encoding ? If i replace "utf-8" for 
> "windows-1251" this code will still work ?
>   b) Is there another clean way to use "utf-8" in my jsp pages ?
>    
>    I've read the document in http://tagunov.tripod.com/i18n/i18n.html 
> but i'm not sure if i could understand it.   :-(
> 
> 2 ) When i use request.setEncoding( "windows-1251") and 
> request.getParameter( "some_param" ), which one of these sentences will 
> be true ?
> 
>     a) request.getParameter() will do
> 
>         byte [] b = s.getBytes( "iso-8859-1");
>         return new String( b, "windows-1251" );
> 
>     b) request.getParameter() will do
>  
>         byte [] b = s.getBytes( "windows-1251" );
>         return new String( b );       
> 
>     c) request.getParameter() will do
>  
>         byte [] b = s.getBytes( "windows-1251" );
>         return new String( b, "windows-1251" );       
> 
>     d) request.getParameter() will do
> 
>         byte [] b = s.getBytes();
>         return new String( b, "windows-1251" );
> 
> 
>                     Thanks in advance !!!!
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to