I just wrote the same Groovy script in Eclipse (everything set to UTF-8
there) under Windows.
I start it and get 6 as the result.
I write an equivalent Java class and get the expected 3.
If I access the Java String from the Groovy script, I get the expected 3.
So somewhere there is a difference between Java and Groovy here!
Russel Winder schrieb:
On Fri, 2007-03-23 at 11:57 -0500, Michael Baehr wrote:
I'm not sure about Windows XP - isn't it Unicode anyways? It is set to
German though. My Linux is en_US.UTF-8.
Windows uses UTF-16 LE as its default character encoding as far as I
know, but then I don't use Windows.
But I'm not even talking about printing the String to the console (this
is a problem with my Linux installation as well, as it seems to have
some problems with Unicode), but the interpretation of the Groovy file
by the Groovy interpreter/compiler.
Linux should have no problems using Unicode. If you are having troubles
then that would indicate something troublesome in your set up.
How are the -c / --encoding switches supposed to be used?
I recollect having problems with these options in the past, so I ensured
I had all my environment variables set correctly and the problems went
away. I suspect but cannot show that the JVM chooses it's encoding
early on in the boot cycle and you cannot change it once set.