Thanks Knut,

Using numeric is more difficult because I have to make a program to 
write these values as I don't know them, and after that I cannot check 
my source code anymore... I'll try to see if it changes something. But 
in the same time, source code is not used at run time, and the problem 
is at run time.
I checked my locales on unix and there is no other locale installed than 
UTF-8. On mac it is more difficult to check.

Knut Forkalsrud wrote:
> You may want to double check if you really have UTF-8 in your 
> environment in all circumstances.
> Here you also depend on the character set of the source file, which is 
> unnecessary.
> And your code could be simpler.
> 
> char[] urlset3a = {0xc0,\u00c1, ....   // either numeric literals or 
> unicode escapes
> char[] urlset3b = {'a','a'....
> 
> String s = <input>;
> for (int i=0; i<urlset3a.length; i++)
>   s = s.replace(urlset3a[i], urlset3b[i]);
> 
> return s;
> 
> 
> 
> On Fri, Jan 15, 2010 at 00:40, Riccardo Cohen 
> <r...@architectedulogiciel.fr <mailto:r...@architectedulogiciel.fr>> wrote:
> 
>     Hello
>     I wrote a piece of code to remove diacritics :
> 
>     String urlset3a[]={"À","Á"....
>     String urlset3b[]={"a","a"....
>     for (idx=0;idx<urlset3a.length;idx++)
>     {
>      String lit=null;
>      try{lit=new String(urlset3a[idx].getBytes(),"UTF-8");}catch(Exception
>     ex){}
>      if (lit!=null)
>       sb_replace(ret,lit,urlset3b[idx]);
>     }
> 
>     This code works perfectly on macosx and on linux when compiled on the
>     plateform it is run on.
> 
>     javac com/adl/java/utils/Stringutils.java
>     java com.adl.java.utils.Stringutils "aÄaé° ç%Щx"
>     URL:aaae-cx
> 
>     But when I compile this class on macosx and if I copy and use this
>     .class on linux, the accents and special characters are no more replaced
>     correctly (same in the other way) :
> 
>     Mac class used on linux :
>     java com.adl.java.utils.Stringutils "aÄaé° ç%Щx"
>     aäaé°-çx
> 
>     Linux class used on mac :
>     java com.adl.java.utils.Stringutils "aÄaé° ç%Щx"
>     URL:a?a??-?x
> 
>     My LANG env var is fr_FR.UTF-8 on both plateforms. java version
>     "1.5.0_17" on linux and "1.5.0_22" on mac
> 
> 
>     Does anybody know why and how to correct this ? (this class is in a jar
>     that is copied to the server and not compiled by resin)
>     Thanks
>     --
>     Riccardo Cohen
>     Architecte du Logiciel
>     http://www.architectedulogiciel.fr
>     +33 (0)6.09.83.64.49
>     Membre du réseau http://www.reflexe-conseil-centre.org
> 
> 
> 
> 
>     _______________________________________________
>     resin-interest mailing list
>     resin-interest@caucho.com <mailto:resin-interest@caucho.com>
>     http://maillist.caucho.com/mailman/listinfo/resin-interest
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest

-- 
Riccardo Cohen
Architecte du Logiciel
http://www.architectedulogiciel.fr
+33 (0)6.09.83.64.49
Membre du réseau http://www.reflexe-conseil-centre.org




_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to