-
Notifications
You must be signed in to change notification settings - Fork 23
Fix console getting confused by unicode characters #278
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
base: master
Are you sure you want to change the base?
Conversation
|
I didn't find that ISO 8859-1 setting anywhere ( |
When running in a Almalinux 10 base install |
Local, remote? Bare metal? BIOS or UEFI? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find that ISO 8859-1 setting anywhere (ESC %@).
https://linux.die.net/man/7/utf-8 (From the Linux manpages package):
The official ESC sequence to switch from an ISO 2022 encoding scheme (as used for instance by VT100 terminals) to UTF-8 is ESC % G ("\x1b%G"). The corresponding return sequence from UTF-8 to ISO 2022 is ESC % @ ("\x1b%@"). Other ISO 2022 sequences (such as for switching the G0 and G1 sets) are not applicable in UTF-8 mode.
When I test with Qemu it looks like the borders are fine, when connected using Putty they looks wrong.
Putty has a config:
Window → Translation → "Enable VT100 line drawing even in UTF-8 mode".
and it's not enabled by default.
More details on how to configure Putty versions behave on Linux/Windows: https://stromasys.atlassian.net/wiki/spaces/KBP/pages/15138858/Cannot+get+correct+line+drawing+on+Linux+UNIX+with+Putty
and also https://serverfault.com/questions/475925/how-to-fix-putty-showing-garbled-characters
So sending "\x1b%@" to putty should disable UTF-8 mode and allow the line drawing to work in Putty. That sounds messed up.
@ydirson I'm guessing that this is for putty:
To keep the sequence for putty, the code could check if the tty is a local Linux console tty or serial / pseudo tty and not emit the sequence for real Linux console ttys? (or switch all terminals to UTF-8 mode, see my next comment)
UEFI guest in XCP-ng, standard console in XO
no, no putty here :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to send this idea:
But as this image shows, the default radiobutton selector for "Handling of line drawing characters" is: "Use Unicode line drawing code points":
As https://linux.die.net/man/7/utf-8 says:
The official ESC sequence to switch from an ISO 2022 encoding scheme (as used for instance by VT100 terminals) to UTF-8 is ESC % G ("\x1b%G").
Thus, if we use
print("\033%G") to instead switch all terminals (including putty) to UTF-8 mode then it should work for new Linux consoles and Putty, I'd hope.
|
This tty mode change naturally does not impact just host-installer, so for diag purposes
|
Of course, the terminal's mode (vt100 drawing -> "\033%@") and the Unix terminal charse (
|
oh sry I misunderstood :)
It will likely work on all UTF-8 enabled envs, which unfortunately is not yet universal, as this putty example seems to show. Though, in my tests things are not 100% clear, as using I'll make the change as you suggest. |
If NEWT was obeying the locale setting, this explicit switch would just need to be dropped, but since it outputs unicode chars whatever locale gets selected, the most suitable workaround is to tell the tty what to expect. Signed-off-by: Yann Dirson <yann.dirson@vates.tech> Co-authored-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
bernhardkaindl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, approving.
Of course, with the reservation that a 2nd approval is needed, which would be @freddy77 regarding not breaking the cases XenServer cares for.
|
I surely will want to check
|

The OS should have set a proper environment for the console to draw
line characters. Disabling UTF-8 just breaks this when the console
has been properly configured for UTF8.