Dec 13, 2025, 19:08

Sat, 13 Dec 2025 19:08:45 +0000
nvi

@r1w1s1 be careful with nvi on GNU/Linux editing arbitrary files. At least the Debian version can lead to unrecoverable data loss if you don’t have a backup.

The longer story: if you set, for example, your user locale to a UTF-8 locale, then the locale-ified nvi (as opposed to the boring old one in ancient OpenBSD) tries to convert multibyte to wide characters on reading. If the file contains an octet sequence that’s not valid UTF-8, this will, of course, fail. #nvi tells you that… when you try to save the modified file, after it has already truncated it to that point.

There are saner editors which allow you to retain, delete, and even edit and create new such sequences in an otherwise UTF-8 (or ASCII) file.