In groovy println "£" gives £, in gradle println "£" gives ┬ú has anyone else seen this?

(Richard Johnson) #1

in groovy println “£” gives £, in gradle println “£” gives ┬ú has anyone else seen this?

(Luke Daley) #2

You need to make sure your VM is running with an encoding that supports that character.

You can do this by setting JAVA_OPTS or GRADLE_OPTS to ‘-Dfile.encoding=utf8’.

(Richard Johnson) #3

I can change the encoding to suit, the reason I point it out is that I shouldn’t have to when groovy in the same environment works fine ‘out of the box’

I am just pointing out the possibility that the initial user experience could be better

(Luke Daley) #4

Groovy doesn’t do anything different here. It doesn’t set this automatically.

Are you running both with the same environment vars and Java version?

(Richard Johnson) #5

Both Gradle and Groovy report[‘file.encoding’] = Cp1252 I am running in the same command line and java version is 1.7.0_13 as reported by ‘java -version’ and ‘[‘java.version’]’ from both groovy and gradle.

Yet println “£” works in groovy but not gradle

are there any other environment checks I could do because it really looks to me like a gradle bug

(Luke Daley) #6

How are you executing the Groovy code?

(Richard Johnson) #7

I was just using groovysh as a quick test, however since you’ve asked the question I’ve now tried "groovy -e “println ‘£’” and that didn’t print the character properly either.

So it’s groovysh that’s configuring something, although it’s not the file.encoding option?!?!

Sorry for implying the experience of gradle was less than groovy out of the box :stuck_out_tongue:

(Luke Daley) #8

I think I know what’s happening…

When you’re in the shell there’s no encoding mismatch as it’s all happening in the JVM. In other cases though there is.

No problems at all. Important to work through these things.