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

sprintf breaks encoding on Windows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.5.6
    • None
    • groovy-jdk
    • None
    • Windows 10

    Description

       

      On Windows when running groovy from command line this code does not write proper UTF-8 character into the file:

      def out=new PrintStream(new File('test.txt'), 'UTF-8')
      out.println sprintf('%s', '\u0439')"

      while String.format() does it right:

      def out=new PrintStream(new File('test.txt'), 'UTF-8')
      out.println String.format('%s', '\u0439')"

      Now if I add JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 before groovy command it works properly. But the problem is that sprintf() does not write to output stream so it should keep Unicode character properly encoded without -Dfile.encoding options.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            arysin Andriy Rysin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: