cursive icon indicating copy to clipboard operation
cursive copied to clipboard

[BUG] - Garbled characters rendering under OpenBSD 7.1

Open canet-benoit opened this issue 2 years ago • 11 comments

Describe the bug

Compiling a Rust cursive application on OpenBSD gives a running executable but the on terminal rendering is garbled

To Reproduce

Build any cursive application and run it under OpenBSD.

Expected behavior

The characters used for the UI decoration should display properly.

Screenshots

signal-2022-06-02-173428

Environment

  • OpenBSD 7.1

  • This bug seems independent of the used back-end.

  • locale LANG= LC_ALL= LC_* = "C"

  • export TERM=linux

  • cursive version used is "0.16.0" for compatibility with OpenBSD 7.1 rust toolchain.

canet-benoit avatar Jun 02 '22 15:06 canet-benoit

Doing:

export LANG=en_US.UTF-8

combined with:

export TERM=linux

gives a less garbled interface:

signal-2022-06-06-150712_001

canet-benoit avatar Jun 06 '22 13:06 canet-benoit

Hi, and thanks for the report!

Cursive only supports utf8 locale. The default locale (or the C locale) are not utf8 and not supported in general.

For your last example, is the en_US.UTF-8 locale properly built? What does locale -a return?

gyscos avatar Jun 07 '22 16:06 gyscos

Hi, thanks for the response.

I took a few screenshots of the 'locale -a' and 'locale -m' command on an OpenBSD box.

signal-2022-06-09-150652_001

signal-2022-06-09-150657

signal-2022-06-09-150704

canet-benoit avatar Jun 09 '22 13:06 canet-benoit

Still 'locale charmap' seems to be another unknown locale.

signal-2022-06-09-152730_001

canet-benoit avatar Jun 09 '22 13:06 canet-benoit

So the locale is correctly installed. Not sure what's going on.

Note: we had another locale issue with NetBSD some time ago: https://github.com/gyscos/cursive/issues/494.

I think @hrkfdn might be using openBSD, he may know how to get this to work.

  • Did you try in a graphical terminal emulator, or just in the native terminal?
  • Did you try one of the curses backends (ncurses, pancurses) and one of the rust-native backends (crossterm, termion)?

gyscos avatar Jun 09 '22 13:06 gyscos

Using a Linux terminal emulator and ssh to the OpenBSD was giving the same result.

I tried the various cursive back-ends a while ago.

canet-benoit avatar Jun 09 '22 13:06 canet-benoit

Setting LC_CTYPE=en_US.UTF-8 makes 'locale charmap' return UTF-8 but does not solve the rendering bug.

canet-benoit avatar Jun 09 '22 13:06 canet-benoit

I tried again to SSH to an OpenBSD box running my cursive enabled code from a Linux machine with: export TERM=linux and export LC_CTYPE=en_US.UTF-8 and the rendering is fine.

Do you have a clue on how to fix this in the OpenBSD console ?

canet-benoit avatar Jun 09 '22 14:06 canet-benoit

I think @hrkfdn might be using openBSD, he may know how to get this to work.

Hey, I don't think I've ever tried using ncspot/Cursive on the console. Only in terminal emulators and there it worked without issues. I'll have a look later to check if it works on my system.

EDIT: Same here with the same locales (pancurses-backend). I only tested with htop and that rendered okay.

hrkfdn avatar Jun 10 '22 19:06 hrkfdn

Hi,

Some follow-up:

With "export TERM=linux" and "export LC_CTYPE=en_US.UTF-8" on a real Linux terminal over SSH the rendering is correct.

This is still a bug but not a bug that affects me anymore.

Thanks !

canet-benoit avatar Jul 26 '22 15:07 canet-benoit

I encountered this problem on a new installation of Arch Linux, where the en_US.UTF-8 locale was set in the environment variables, but not generated with locale-gen, and doing that fixed the problem.

Perhaps it might be a good idea to add this into the documentation as a gotcha. I hadn't expected that the program's environment would affect it that much.

danya02 avatar Sep 03 '23 06:09 danya02