mabe02 / lanterna

Java library for creating text-based GUIs
GNU Lesser General Public License v3.0
2.26k stars 242 forks source link

Bug: Unicode support #533

Open Mee42 opened 3 years ago

Mee42 commented 3 years ago

I'm trying to use a middle dot character (U+00B7) in my TerminalScreen. My terminal supports the character, echo · works.

This also works:

new PrintStream(System.out, true, Charsets.UTF_8).println('\u00B7')

Yet, none of the lanterna apis seem to support it. I've tried the putCharacter/putString on Terminal and for TerminalScreen

TextCharacter.fromCharacter('·')[0]

It renders as a ?. When I force lenterna to open a gui window, it actually renders the dot properly. My guess is that there's a check to see if the output terminal supports unicode, and there's a bug that it returns "unsupported" for my terminal emulator, terminator.

Thanks for your help :)

avl42 commented 3 years ago

I think that is not about the TERM variable, but instead about either LANG, LC_ALL or LC_CTYPE variables.

If you tell us the values of those variables inside "terminator", we might be able to aid you how to change it, but maybe, if you see the values, you might already know what to fix about them ;-)

mabe02 commented 3 years ago

@Mee42 can you try this with 3.1.1?

        Terminal terminal = new TestTerminalFactory(args).createTerminal();
        Screen screen = new TerminalScreen(terminal);
        screen.startScreen();
        screen.newTextGraphics().putString(4, 2, "Hello!");
        screen.setCharacter(4, 2, TextCharacter.fromString("·")[0]);
        screen.refresh();
        Thread.sleep(5000);
        screen.stopScreen();