Incorrect UTF-8 accents in vi/vim on OpenBSD 6.2

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.