Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Duplicate
    • Affects Version/s: 1.0
    • Fix Version/s: 1.3
    • Component/s: compile
    • Labels:
      None
    • Number of attachments :
      1

      Description

      When I set sourceEncoding to UTF-8 this setting is ignored and groovy script is still compiled probably using platform default encoding.

      I can see that sourceEncoding is properly set to UTF-8 in debug log :

      [DEBUG]Configuring mojo 'org.codehaus.groovy.maven:gmaven-plugin:1.0-rc-5-kohsuke-1:compile' -->
      ...
      [DEBUG] (f) sourceEncoding = UTF-8
      ...
      [DEBUG]-- end configuration –

      Strings that originaly contained multi-byte UTF-8 characters are damaged in compiled class file.

        Issue Links

          Activity

          Hide
          Matthias Bohlen added a comment -

          Got the same problem!

          Hey guys, this issue is extremely important for the Asian and the European markets! We here in Germany have umlaut characters like "" - they are part of our language! We need to compile them correctly in Groovy! The Asian people have many many more special characters so that they also need UTF-8. Please, please, make this work!

          Show
          Matthias Bohlen added a comment - Got the same problem! Hey guys, this issue is extremely important for the Asian and the European markets! We here in Germany have umlaut characters like "" - they are part of our language! We need to compile them correctly in Groovy! The Asian people have many many more special characters so that they also need UTF-8. Please, please, make this work!
          Hide
          Matthias Bohlen added a comment -

          The reason for the erroneous behavior was that the compiler options got lost before they could be passed to the compiler. This is because AbstractCompileMojo fills them AFTER ClassCompilerFeature needs them.

          I moved the code that copies the compiler options into another place, right before the point where the Groovy compiler is invoked.

          The change is attached to this Jira issue, now. The file name is ClassCompilerFeature.java.diff. Could you please apply the patch to the source code?

          Thanks!

          Show
          Matthias Bohlen added a comment - The reason for the erroneous behavior was that the compiler options got lost before they could be passed to the compiler. This is because AbstractCompileMojo fills them AFTER ClassCompilerFeature needs them. I moved the code that copies the compiler options into another place, right before the point where the Groovy compiler is invoked. The change is attached to this Jira issue, now. The file name is ClassCompilerFeature.java.diff. Could you please apply the patch to the source code? Thanks!
          Hide
          Matthias Bohlen added a comment -

          I found a workaround. Before you start Maven, set the variable MAVEN_OPTS.

          Windows:
          set MAVEN_OPTS=-Dgroovy.source.encoding=UTF-8

          Mac/Linux/Unix (bash):
          export MAVEN_OPTS=-Dgroovy.source.encoding=UTF-8

          This causes the Groovy compiler to recognize the encoding of the source files.

          Show
          Matthias Bohlen added a comment - I found a workaround. Before you start Maven, set the variable MAVEN_OPTS. Windows: set MAVEN_OPTS=-Dgroovy.source.encoding=UTF-8 Mac/Linux/Unix (bash): export MAVEN_OPTS=-Dgroovy.source.encoding=UTF-8 This causes the Groovy compiler to recognize the encoding of the source files.
          Hide
          Jason Smith added a comment -

          I've promoted this from "Major" to "Critical."

          Show
          Jason Smith added a comment - I've promoted this from "Major" to "Critical."
          Hide
          Keegan Witt added a comment -

          Actually it doesn't look like it's even using the platform default encoding. I tried on Linux where the platform default encoding is UTF-8 and on Windows where the platform default encoding is Windows-1252. In both cases, it used ISO-8859-1 as the encoding of the class file generated, despite the fact the source was encoded in the platform default encoding. I tested this with version 1.2 of the plugin and Groovy 1.7.0. I don't understand how this is happening. It's been almost a year since this issue has been updated. Does the supplied patch work?

          Show
          Keegan Witt added a comment - Actually it doesn't look like it's even using the platform default encoding. I tried on Linux where the platform default encoding is UTF-8 and on Windows where the platform default encoding is Windows-1252. In both cases, it used ISO-8859-1 as the encoding of the class file generated, despite the fact the source was encoded in the platform default encoding. I tested this with version 1.2 of the plugin and Groovy 1.7.0. I don't understand how this is happening. It's been almost a year since this issue has been updated. Does the supplied patch work?
          Hide
          Ronny Lvtangen added a comment -

          I think this is the same issue as GMAVEN-65.
          Both jiras have a patch attached, but none of them are scheduled for any release.
          This is critical for all languages with more letters than a-z. Can this fix be included in the 1.3 release? Please

          Show
          Ronny Lvtangen added a comment - I think this is the same issue as GMAVEN-65 . Both jiras have a patch attached, but none of them are scheduled for any release. This is critical for all languages with more letters than a-z. Can this fix be included in the 1.3 release? Please
          Hide
          Yasuharu NAKANO added a comment -

          I've gotten the same problem!
          Please fix it and release the bug fix version.

          Show
          Yasuharu NAKANO added a comment - I've gotten the same problem! Please fix it and release the bug fix version.

            People

            • Assignee:
              Jason Dillon
              Reporter:
              Vojtech Habarta
            • Votes:
              7 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: