Re: Reg. Non-English string literal in Java code

Dan Leuck <[email protected]> Thu, 10 Nov 2011 03:43:49 -1000
Newsgroups gmane.comp.java.beanshell.user
Message-ID <[email protected]>
It's Beanshell. The interpreter should be assuming UTF8 and reading the cyrillic chars directly just as XML parsers do by default. Writing non-ASCII chars with Unicode escapes is laborious. It drives me nuts with Japanese (and yes, I know there is tool support but this should be default for all interpreters and compilers these days.) Hopefully we can find some time to fix this.

Sent from my iPad

On Nov 10, 2011, at 3:10 AM, "David Lee" <[email protected]> wrote:

> Are you sure this is beanshell not javac which is corrupting things ?
> Take beanshell out and print your array to see.
> 
> #1 guess is that when you save the file its not saving it in a unicode (UTF8
> or UTF16) representation so when javac comes along the data is already
> corrupted.
> You can use unicode escapes to solve this   "\uXXXX\uXXXX ..."   
> And possibly (not tested) is to use the  system property  file.encoding to
> make sure you file matches javac's expectation.
> But you also need a text editor which stores in a known encoding.
> 
> 
> ----------------------------------------
> David A. Lee
> [email protected]
> http://www.xmlsh.org
> 
> -----Original Message-----
> From: Rathna Kumar [mailto:[email protected]] 
> Sent: Thursday, November 10, 2011 6:31 AM
> To: beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Subject: [Beanshell-users] Reg. Non-English string literal in Java code
> 
> Hi,
> I am using bean shell interpreter to execute Java code.
> If any string literal in Java code has non-English characters (say, Russian)
> then such characters becomes garbled when the interpreter is executing the
> code.
> Is there a way to support internationalization during bean shell interpreter
> execution of Java code ?
> 
> Usage of bean shell interpreter
> Interpreter interpreter = new Interpreter(); interpreter.eval(javaCode);
> 
> Content of javaCode
> ArrayList aList = new ArrayList();
> aList.add("<RussianCharsHere>");
> aList.add("<RussianCharsHere>");
> 
> Any help is appreciated.
> 
> Thanks
> Rathna Kumar R
> ----------------------------------------------------------------------------
> --
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> Beanshell-users mailing list
> Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
> 
> 
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> Beanshell-users mailing list
> Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/beanshell-users

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1