When creating Groovy objects from String via GroovyClassLoader, e.g. like in GStringTemplateEngine , the Constructor of GroovyCodeSource(String script, String name, String codeBase) translates all UTF-8 Chars with a value > 0xFF into '?'.
You can see this in the GroovyConsole aswell:
Run the script
and you will see the correct sourcecode in the first line, but the output is ?????
Or in Java code:
loader.parseClass(new GroovyCodeSource("println 'こんにちは';", "TestScript", "x");
cripples them down to byte values.
I worked around it by while creating my script I escape character > 0xFF with the /u-Notation like /u1234 but this is not always possible as in the Groovy console.