graalvm / graalvm/container

Multibyte characters are garbled

Open
#46 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
No language data
Stars
190
Forks
39
PR merge metrics
No merged PRs in 30d

Description

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#

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided Docker command, the Java source, and javac, then inspect the container image definition for its default LANG value. Check locale -a inside the image and verify that the proposed setting allows the source to compile and run without garbled characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
devops, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.