Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3231

SimpleTemplateEngine (internally) uses shell's encoding irrespectfully to the incoming reader encoding

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.7
    • None
    • Templating
    • None
    • it's more apparent on Windows

    Description

      It's discussed in http://www.nabble.com/forum/ViewPost.jtp?post=21058369&framed=y

      I had a UTF-8 template with non-latin content (Russian), Windows's default encoding is cp-1252 and template engine uses it on a certain stage, so non-latin characters can be broken and the resulting HTML ends up with garbage rather than Russian letters. See attachment for such a template.

      Here is Guillaume's analysis:

      After a quick examination, although the reader properly reads the
      content of the template, we then generate some Groovy script
      representing that template, and that template is transformed into an
      inputstream of bytes using the engine's shell's encoding to be fed to
      groovy classloader at some point.
      The problem is when we get the bytes of the script, we use the shell's
      encoding, and if none was provided (by means of CompilerConfiguration)
      then the default system encoding is being used. So your UTF-8
      characters are read as ISO something instead, hence the ugly
      characters you see.

      Attachments

        1. test.ghtml
          1 kB
          Yegor Kozlov

        Activity

          People

            Unassigned Unassigned
            yegor Yegor Kozlov
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: