6

After a default install of OpenBSD 6.2 with FVWM, I open an xterm on the FVWM GUI, with normal user, create a test file:

$ echo 'árvíztűrő tükörfúrógép' > test.txt
$ echo 'ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP' >> test.txt
$ 
$ cat test.txt
árvíztűrő tükörfúrógép
ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP
$ 
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_MESSAGES="C"
LC_ALL=
$ 
$ env | grep -i locale
XTERM_LOCALE=C
$ 

and the problem is that if I open the testfile with vi:

enter image description here

and with vim, a little better, but still problems with uppercase and a few lowercase:

enter image description here

Tried to set all the locale variables to "hu_HU.UTF-8" but didn't helped. What am I missing?

Back in the older days, afaik, there was "uxterm" to have UTF-8 support, but now, it looks like it is not in OpenBSD anymore.

  • uxterm is just a shell script that calls xterm. – Thomas Dickey Dec 31 '17 at 14:22
  • 1
    Does it work as expected if you run LC_ALL=hu_HU.UTF-8 vim testfile? – terdon Dec 31 '17 at 15:36
  • If OP hasn't installed the locales, that won't help :-) – Thomas Dickey Dec 31 '17 at 15:39
  • that's how vi behaves on OpenBSD 6.2 for unicode – thrig Dec 31 '17 at 16:32
3
+100

If you make sure that you are using the proper locale, then you will be able the see the correct characters in vim and in nvi, but not in vi.

$ LC_CTYPE=hu_HU.UTF-8 vim test.txt

or,

$ export LC_CTYPE=hu_HU.UTF-8
$ vim test.txt

In fact, it works (in vim/nvi) with the en_US.UTF-8 locale as well. OpenBSD's vi is not UTF-8 aware.

Vim showing the text file

This was tested on OpenBSD-current (pre-6.3) with the base system's vi as well as with vim and nvi from ports. The picture shows Vim from OpenBSD ports (vim-8.0.1255p0-no_x11) running in PuTTY from a Windows host, but I tested it successfully in OpenBSD's FVWM with the standard xterm too. The locale is hu_HU.UTF-8 in the picture. Setting the locale to C gives the same result as you show in the question.

The correct locale could be set in your .xsession file (or .xinitrc, depending on whether you log in from xenodm or start X11 with startx on the console):

export LC_ALL=en_US.UTF-8

fwvm & wmpid=$!
xterm &

wait "$wmpid"

(or something similar)

Note that the LC_ALL and/or LC_CTYPE variable needs to be exported.


Regarding uxterm: uxterm seems to have been removed after the release of OpenBSD 6.0.

The commit message (from Mon, 24 Oct 2016 13:55:37) simply reads

Stop providing the uxterm and koi8rxterm shell scripts.
Requested by schwarze@ agreed naddy@

There is, however, a port called rxvt-unicode which provides the urxvt utility.

  • also I was using a "ISO-8859 text"... only/at least the "Non-ISO extended-ASCII text" works with the mentioned export LC_CTYPE – Hessnov Feb 4 '18 at 20:36
1

The OpenBSD version of vi doesn't support UTF-8 yet. Vim will work fine but you need a terminal with support for UTF-8 and the correct locales. I don't remember how many locales includes OpenBSD, so try with en_US.UTF-8 as LC_CTYPE.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.