• Locales and pseudo-graphics

    From Vitaliy Aksyonov@1:104/117 to All on Sunday, March 17, 2024 13:47:38
    Hello All.

    In result of some research I decided to write short instruction, which may help you to solve issues with pseudo-graphics in GoldEd.

    I want to mention that following text is for Linux (maybe it's very similar on MacOS, but I haven't tried), one-byte charsets and locales. You won't find anything about running GoldEd in Unicode locale here. I plan to investigate, how ncurses works with Unicode later.

    So if you have issues with pseudo-graphics, you need to try following insructions. All my examples are for KOI8-R, but shall not be any issues with CP437 and other one-byte encodings.

    Also this insruction assumes, that you don't use recodings (like luit) and/or terminal multiplexors (screen, tmux).

    1. Make sure that your terminal uses correct charset. I tried both remote ssh access with Putty and local console with Gnome terminal. In both cases I've set KOI8-R.

    2. Try to run following script in console.

    printf '%b' $(printf '\\%03o' {128..255})

    You should see sequence of national letters, pseudo-graphics (if your charset has it) and some special symbols. If it doesn't - check your terminal settings for charset and try to use different fonts.

    3. Very important to use correct locale when you run GoldEd. In my case it's ru_RU.koi8r. It may differ from system to system. Also keep in mind that you're not required to change whole system locale. Locale is a process property and you may run GoldEd in locale which differs from your system's locale with:

    LANG=ru_RU.koi8r gedlnx -C<path to my config>

    Also make sure that such locale actually exists in your system with "locale -a". If it doesn't - read your system manual, how to install or generate desired locale.

    4. Make sure that you use correct terminal type and terminfo for such terminal is available.

    "echo $TERM" will show you which terminal type is used. And such terminal type description shall be in your system. Try to run "infocmp". If it prints something like:

    "infocmp: couldn't open terminfo file /usr/share/terminfo/w/weirdterminal", then you need to install correct terminfo. Refer your's system documentation.

    That is enough to make pseudo-graphics work.

    And now let me explain, why locale is important. It's all because ncurses tries to detect if symbol is "printable". And does that using functions isprint and iscntrl. Those functions use locale information. And when locale doesn't correspond text to print, ncurses process those symbols as control symbols. That's why you see those M~D sequences.

    All that stuff worked for me in luit. I didn't try in screen. But I prefer to run it directly without any additional layers.

    Hope this instuction may help somebody else.

    Vitaliy

    ... 640K ought to be enough for anybody
    --- GoldED+/LNX 1.1.5-b20240305-beta
    * Origin: Aurora, Colorado (1:104/117)