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

Multibyte characters are garbled #46

Open
kazuki43zoo opened this issue Feb 7, 2022 · 3 comments
Open

Multibyte characters are garbled #46

kazuki43zoo opened this issue Feb 7, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@kazuki43zoo
Copy link

kazuki43zoo commented Feb 7, 2022

When I compile a Java code with multibyte characters using javac command, failed compile.

Java Source Code

public class Test {
  public static void main(String[] args) {
   System.out.println("↓");
  }
}

Procedures

docker run -v $(pwd):/work -it -w /work \
  ghcr.io/graalvm/graalvm-ce:22.0.0.2 bash
bash-4.4# javac Test.java
Test.java:3: error: unmappable character (0xE2) for encoding US-ASCII
   System.out.println("???");
                       ^
Test.java:3: error: unmappable character (0x86) for encoding US-ASCII
   System.out.println("???");
                        ^
Test.java:3: error: unmappable character (0x93) for encoding US-ASCII
   System.out.println("???");
                         ^
bash-4.4#

Solution for this behavior

I've fixed to change environment variable value of LANG to C.utf8 from en_US.UTF-8.

docker run -v $(pwd):/work -it -w /work \
  -e LANG=C.utf8 \
  ghcr.io/graalvm/graalvm-ce:22.0.0.2 bash

It's working fine.

bash-4.4# javac Test.java
bash-4.4# java Test
↓
bash-4.4#

Proposal

I will propose to change default LANG value to C.utf8 from en_US.UTF-8.

p.s:

The en_US.UTF-8 not installed on container by default.

bash-4.4# locale -a
C
C.utf8
POSIX
bash-4.4#
@mlouriz
Copy link
Contributor

mlouriz commented Feb 9, 2022

Thank you for your report, looking into this.

@mlouriz mlouriz self-assigned this Feb 9, 2022
@mlouriz mlouriz added the bug Something isn't working label Feb 9, 2022
@tisonkun
Copy link

The same here. See also korandoru/hawkeye#57.

@tisonkun
Copy link

Hacking fix as korandoru/hawkeye@8433b64.

Alter the default lang can be a breaking change. I may prefer generate en_US.UTF-8 instead so I can remove the ENV command and make things work by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants