25 messages in org.codehaus.groovy.userRe: [groovy-user] File encoding problem
FromSent OnAttachments
Michael BaehrMar 23, 2007 7:25 am 
Guillaume LaforgeMar 23, 2007 9:31 am 
Michael BaehrMar 23, 2007 9:57 am 
Guillaume LaforgeMar 23, 2007 10:07 am 
Michael BaehrMar 23, 2007 10:16 am 
Guillaume LaforgeMar 23, 2007 10:20 am 
Michael BaehrMar 23, 2007 10:24 am 
Guillaume LaforgeMar 23, 2007 12:19 pm 
Michael BaehrMar 23, 2007 12:36 pm.groovy
Russel WinderMar 23, 2007 12:41 pm 
Guillaume LaforgeMar 23, 2007 12:47 pm 
Michael BaehrMar 23, 2007 12:52 pm 
Russel WinderMar 23, 2007 12:53 pm 
Michael BaehrMar 23, 2007 12:54 pm 
Russel WinderMar 23, 2007 12:58 pm 
Michael BaehrMar 23, 2007 1:01 pm 
Russel WinderMar 23, 2007 1:04 pm 
Michael BaehrMar 23, 2007 1:05 pm 
Russel WinderMar 23, 2007 1:06 pm 
Michael BaehrMar 23, 2007 1:24 pm 
Russel WinderMar 23, 2007 1:31 pm 
Michael BaehrMar 23, 2007 1:40 pm 
Gavin GroverMar 23, 2007 4:51 pm 
Barzilai SpinakMar 23, 2007 6:39 pm 
Jochen TheodorouMar 25, 2007 9:59 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [groovy-user] File encoding problemActions...
From:Michael Baehr (code@googlemail.com)
Date:Mar 23, 2007 12:52:26 pm
List:org.codehaus.groovy.user

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.