Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.8.6
-
Fix Version/s: None
-
Component/s: GroovyScriptEngine
-
Labels:None
-
Environment:Windows XP/2003, locale China
-
Number of attachments :
Description
In Windows (XP or 2003, I did't test Win7) with locale as China, when run a script in a new GSE instance, it will return the correct result, but when re-run the script with the old GSE instance, the result will be messy code.
But it will be all right in Linux (mine is Ubuntu 11.04).
Below is my test code, they can run in GroovyConsole directly, and my groovy version is 1.8.6.
The test step is:
1. run code1: that will create a new GSE instance;
2. run code2: the result will be "你好", it is correct;
3. run code2 again: the result will be "浣犲ソ", it's messy.
code 1
class GseHolder {
static GroovyScriptEngine gse = new GroovyScriptEngine("D:\\test", Thread.currentThread().contextClassLoader);
}
return;
code 2
String script = "return '你好';" String filename = "test1.groovy"; def gse = GseHolder.gse; //gse.config.setSourceEncoding("UTF-8"); String fullname = "D:\\test\\" + filename; new File(fullname).write(script, "UTF-8"); gse.run(filename, new Binding())
Why I can not edit the issue? the codes are wrong, the correct codes at:
http://groovy.329449.n5.nabble.com/GroovyScriptEngine-return-messy-code-at-Windows-td5710184.html