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

[native-image] ASCII characters do not print to console #2398

Closed
pquiring opened this issue Apr 25, 2020 · 2 comments
Closed

[native-image] ASCII characters do not print to console #2398

pquiring opened this issue Apr 25, 2020 · 2 comments
Assignees
Milestone

Comments

@pquiring
Copy link

Describe the issue
ASCII characters do not print to the console. The sample below will print a simple ASCII gradient.

Steps to reproduce the issue

  1. Compile program below (javac ASCII.java)
  2. Run with normal java (java ASCII) Output is correct.
  3. Generate native-image (native-image ASCII)
  4. Run native version (ASCII.exe) Output only shows '?' characters.
public class ASCII {
  private static char[] table = (
    "\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5" +
    "\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9\u00FF\u00D6\u00DC\u00A2\u00A3\u00A5\u20A7\u0192" +
    "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA\u00BF\u2310\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" +
    "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" +
    "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" +
    "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" +
    "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u00B5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" +
    "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0"
  ).toCharArray();

  public static char convert(char ascii) {
    if (ascii < 128) return ascii;
    if (ascii > 255) return ascii;
    return table[ascii-128];
  }
  public static char convert(int ascii) {
    return convert((char)ascii);
  }
  public static void main(String args[]) {
    System.out.println("ASCII=" + convert(176) + convert(177) + convert(178) + convert(219));
  }
}

Describe GraalVM and your environment:

  • GraalVM version CE 20.0
  • JDK major version: 11
  • OS: Windows10
  • Architecture: AMD64
@fernando-valdez
Copy link
Member

Hello @pquiring, this issue was reported to the dev team. We will let you know when we have a fix.

@christianwimmer christianwimmer added this to the 20.3 milestone Oct 5, 2020
graalvmbot pushed a commit that referenced this issue Oct 30, 2020
@fernando-valdez
Copy link
Member

Hi @pquiring,
The fix was pushed and it will be available on GraalVM 20.3.
Thanks!

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

5 participants