Issue Details (XML | Word | Printable)

Key: GROOVY-783
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Paul King
Reporter: Zhenbang Wei
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

Make GroovyShell read script using specified encoding

Created: 22/Mar/05 05:49 AM   Updated: 13/Oct/07 09:19 PM
Component/s: parser
Affects Version/s: 1.0-beta-10
Fix Version/s: 1.1-rc-2

Time Tracking:
Not Specified

Environment: Windows 2000 Pro SP4, Traditional Chinese edition
J2SDK 1.5.0_02


 Description  « Hide
I use groovy template engine to generate reports in different languages such as English, Chinese, Japanese, and Korean. The templates I created are UTF-8 encoded. Currently SimpleTemplateEngine.createTemplate("scriptAsString") invokes GroovyShell.parse(String scriptText) which converts string to a byte array using String.getBytes(). Since I am running Traditional Chinese Windows, getBytes() is equal to getBytes("Big5") and breaks characters in other language like Japanese. To resolve this, the parse() and related methods may need an charset argument or do not convert script to byte array simply using getBytes().

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Paul King added a comment - 13/Oct/07 09:19 PM
SimpleTemplateEngine (and all other TE's) now allow you to provide your own GroovyShell which allows you to set the encoding via CompilerConfiguration if you wish.