You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Andriy Rysin (JIRA)" <ji...@apache.org> on 2019/02/07 02:40:00 UTC
[jira] [Updated] (GROOVY-8982) sprintf breaks encoding on Windows
[ https://issues.apache.org/jira/browse/GROOVY-8982?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andriy Rysin updated GROOVY-8982:
---------------------------------
Affects Version/s: (was: 2.5.4)
2.5.6
> sprintf breaks encoding on Windows
> ----------------------------------
>
> Key: GROOVY-8982
> URL: https://issues.apache.org/jira/browse/GROOVY-8982
> Project: Groovy
> Issue Type: Bug
> Components: groovy-jdk
> Affects Versions: 2.5.6
> Environment: Windows 10
> Reporter: Andriy Rysin
> Priority: Major
>
>
> On Windows when running groovy from command line this code does not write proper UTF-8 character into the file:
> {code:java}
> def out=new PrintStream(new File('test.txt'), 'UTF-8')
> out.println sprintf('%s', '\u0439')"{code}
> while String.format() does it right:
> {code:java}
> def out=new PrintStream(new File('test.txt'), 'UTF-8')
> out.println String.format('%s', '\u0439')"{code}
> 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.
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)