struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: i18N jsp application on linux and windows
Date Mon, 18 Feb 2008 14:40:39 GMT
Did you see my previous reply?

http://www.nabble.com/i18N--jsp-application-on-linux-and-windows-tp15451735p15467087.html

And for the record, your convertTo... method probably isn't doing the 
right thing. If response.getCharacterEncoding() returns anything other 
than ISO-8859-2, your code will corrupt the string since it's explicitly 
trying to apply ISO-8859-2 encoding to a set of bytes in a different 
character set...! I'd start by ripping that code out all together.

L.

Raghuveer wrote:
> I need an help related to i18n (internationalization),…
> 
> http://www.mail-archive.com/user@struts.apache.org/msg72581.html
> 
>  
> 
>  
> 
> I am developing an application an struts application to be used in poland
> for English,polish language on tomcat.
> 
>  
> 
> There is scenario to extract SAP messages and show to the user in browser in
> JSP page.
> 
>  
> 
> I have written following method to read SAP message and Convert to IS0-559-2
> charset( for Poland).
> 
> This is working for me on XP and Windows 2000 in Hyderabad.
> 
>  
> 
>  
> 
> I have used IS0-559-2 as encoding attribute in web.xml
> 
> And in JSP pages 
> 
> <%@ page contentType="text/html;charset=iso-8859-2"  %>
> 
>  
> 
>  
> 
> But messages are corrupted some times and getting Question marks when
> deployed and tested application in Poland on Linux.
> 
> Linux- 
> 
> Nr potwierdzenia 8018340248 nie został znaleziony (proszę sprawdzić wpis)
> 
>  Windows
> 
>  
> 
> Nr potwierdzenia 2222222222 nie zosta³ znaleziony (proszê sprawdziæ wpis)
> 
>  
> 
> -----------------------------
> 
>  
> 
> private String convertTo_IS08559_2(HttpServletResponse response, String
> strMessage) throws UnsupportedEncodingException{
> 
>             final String METHOD_NAME = "convertTo_IS08559_2() : ";  // holds
> method name for logger messages
> 
>             String charset = response.getCharacterEncoding();
> 
>             String strFormatedMessage=null;     // holds formatted message
> 
>             
> 
>             Log.info(CLASS_NAME +" - " +METHOD_NAME+" - response -
> "+response);
> 
>             Log.info(CLASS_NAME +" - " +METHOD_NAME+" - charset -
> "+charset);
> 
>             Log.info(CLASS_NAME +" - " +METHOD_NAME+" - strMessage -
> "+strMessage);
> 
>             
> 
>             if(strMessage!=null && strMessage.length()>0){
> 
>                   try {
> 
>                         strFormatedMessage = new
> String(strMessage.getBytes(charset), "ISO-8859-2");
> 
>                   } catch (UnsupportedEncodingException e) {
> 
>                         // TODO Auto-generated catch block
> 
>                         //e.printStackTrace();
> 
>                         Log.error(CLASS_NAME +" - " +METHOD_NAME+" -
> UnsupportedEncodingException - "+e);
> 
>                         throw e;
> 
>                   }
> 
>             } 
> 
>             Log.info(CLASS_NAME +" - " +METHOD_NAME+" - str -
> "+strFormatedMessage);
> 
>             return strFormatedMessage;
> 
>       }
> 
>  
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message