Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scrambled characters for the ± character when running on system with non-UTF8 encoding #709

Closed
remkop opened this issue May 29, 2019 · 0 comments

Comments

@remkop
Copy link
Owner

remkop commented May 29, 2019

Related to #694: encoding issue;

CommandLine source code (UTF-8) contains

            CommandLine.RegexTransformer transformer = new CommandLine.RegexTransformer()
                    .addPattern("^-(\\w)$", "+$1", "±$1")
                    // ...

This shows scrambled characters for the ± character when compiling on a Japanese system

org.junit.ComparisonFailure: expected:<... --X:ツアjava1        [ ...
  -f, --X:ツアjava4         ...
  -g, -X:ツアjava5          ...
  -h, -XX:ツアjava6         ...
      --[no-]long        ...
  -n, --[no-]verbose-b   ...
      --[no-]verbose     ...
      -X:ツアjava2          ...
      -XX:ツアjava3 ]        ...
> but was:<... --X:ツアjava1        [...
  -f, --X:ツアjava4        ...
  -g, -X:ツアjava5         ...
  -h, -XX:ツアjava6        ...
      --[no-]long        ...
  -n, --[no-]verbose-b   ...
      --[no-]verbose     ...
      -X:ツアjava2         ...
      -XX:ツアjava3]        ...
>
	at org.junit.Assert.assertEquals(Assert.java:115)
	at org.junit.Assert.assertEquals(Assert.java:144)
	at picocli.NegatableOptionTest.testUsage(NegatableOptionTest.java:79)

This can be fixed by changing the build:

Index: build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- build.gradle	(date 1559094279228)
+++ build.gradle	(date 1559094279228)
@@ -28,6 +28,9 @@
     targetCompatibility = !org.gradle.api.JavaVersion.current().isJava9Compatible() ?
             1.5 : org.gradle.api.JavaVersion.current().isJava11Compatible() ? 1.7 : 1.6
 
+    compileJava.options.encoding = "UTF-8"
+    compileTestJava.options.encoding = "UTF-8"
+
     repositories {
         jcenter()
     }
@remkop remkop added this to the 4.0-beta-1 milestone May 29, 2019
@remkop remkop changed the title Build encoding scrambled characters for the ± character when running on system with non-UTF8 encoding May 29, 2019
remkop added a commit that referenced this issue May 29, 2019
@remkop remkop closed this as completed May 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant