That did it, thanks. Now I just need to tweak various scripts and aliases to 
use $VISUAL instead of /usr/bin/vi, which I probably should’ve done long ago, 
anyhow. Seems there’s always another yak that needs shaving.

Note that I had no luck just setting the print option in the stock /usr/bin/vi, 
which reports that it's version 1.79 (10/23/96) The CSRG, University of 
California, Berkeley.

-DaveP

On Mon, Oct 26, 2026, at 00:03, Hugo Villeneuve-Lapointe wrote:
> On Sun, Oct 25, 2026 at 08:02:59PM -0600, Dave Polaschek wrote:
>> I’ve got a machine running OpenBSD 8.0 with all the patches (as
>> of a few minutes ago).
>> 
>> I’ve set LC_CTYPE to en_US.UTF-8. printenv shows that it’s set.
>> 
>> My terminal type when I ssh in is xterm-256color.
>> 
>> The terminal I’m using on my Chromebook is hterm
>> (https://hterm.org/x/ssh/faq ) which supports UTF-8, and I’m using
>> Google’s “Noto Sans Mono” as my terminal font, which has the
>> characters I’m testing.
>> 
>> If I type a ¢ into it, for example, I get the hex-escapes displayed
>> in /usr/bin/vi, but when I save the file and dump it using more or
>> cat, the ¢ comes out correctly.
>> 
>> Is there some setting I need to tweak to get vi to display UTF-8
>> characters correctly, or am I just running into a limitation of vi
>> here? I don’t need anything more than ASCII most of the time, but
>> it would be nice to be able to make sure I’ve typed the correct
>> unichar without having to ^z out and cat the file to be sure.
>> 
>> Thanks!
>> 
>> -DaveP
>> 
>
> vi in OpenBSD does not support UTF-8 yet.
>
> You'll have to install an alternate vi from the ports. Either nvi
> or vim will work.
>
> Personnaly, I like nvi+iconv. My ksh's .profile startup script has
> this in it:
>
> LANG=en_US.UTF-8
> if [ -f /usr/local/bin/nvi ]; then
>       VISUAL=/usr/local/bin/nvi 
>       alias ex=/usr/local/bin/nex
>       alias vi=/usr/local/bin/nvi
>       alias view=/usr/local/bin/nview
> else
>       VISUAL=/usr/bin/vi
> fi
> export VISUAL LANG
> set -o emacs
>
>
> Note that for nvi, weird thing happens if you edit a file that is
> not UTF-8 but has high 8bit characters. You might have to run 
> "LANG=C nvi file" to edit it. (nvi+iconv has also a
> fileencoding/inputencoding settings.)
>
> Also, without a LANG set to a UTF-8 encoding, nvi will work like
> the built-in OpenBSD's vi. (Showing \xc3\xa9 instead of é.)
>
> Good luck

Reply via email to