Skip to content

Instantly share code, notes, and snippets.

@md5
Last active February 21, 2017 06:38
Show Gist options
  • Save md5/7793ee806183b1c846be to your computer and use it in GitHub Desktop.
Save md5/7793ee806183b1c846be to your computer and use it in GitHub Desktop.
$ docker build -t java-utf8-test --no-cache  .
  nding build context to Docker daemon 47.62 kB
Sending build context to Docker daemon 
Step 0 : FROM java:8-jdk
 ---> 1fc1263652ea
Step 1 : ADD TestUtf8.java /src/
 ---> c5d7dabbce96
Removing intermediate container 21cc173682b4
Step 2 : WORKDIR /src
 ---> Running in 0bea35ff49ac
 ---> e45b7e4e856f
Removing intermediate container 0bea35ff49ac
Step 3 : RUN javac TestUtf8.java
 ---> Running in b202b2612535
 ---> 6da6e97fc48e
Removing intermediate container b202b2612535
Step 4 : CMD java -cp . -ea TestUtf8
 ---> Running in a79b1d8c3fc2
 ---> b8cbf4c34f8e
Removing intermediate container a79b1d8c3fc2
Successfully built b8cbf4c34f8e
$ docker run -it --rm java-utf8-test 
ANSI_X3.4-1968
?
$ docker run -it --rm -e LANG=C.UTF-8 java-utf8-test 
UTF-8
FROM java:8-jdk
ADD TestUtf8.java /src/
WORKDIR /src
RUN javac TestUtf8.java
CMD ["java", "-cp", ".", "-ea", "TestUtf8"]
public class TestUtf8 {
public static void main(String... argz) {
System.out.println(System.getProperty("file.encoding"));
System.out.println("\u65E5");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment