groovy

Make GroovyShell read script using specified encoding

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.0-beta-10
  • Fix Version/s: 1.1-rc-2
  • Component/s: parser
  • Labels:
    None
  • Environment:
    Windows 2000 Pro SP4, Traditional Chinese edition
    J2SDK 1.5.0_02
  • Number of attachments :
    0

Description

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().

Activity

Hide
Paul King added a comment -

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.

Show
Paul King added a comment - 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.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: