vi(1) and ISO 8859-1

Rocky Hotas rockyhotas at post.com
Thu Apr 4 17:20:06 UTC 2019


Hello!
I have an ISO-8859-1 text file, which is opened and shared by several OSs.
If I open it with vi(1) in FreeBSD 12.0, its encoding is not detected and
UTF-8 is used, instead. Any non-ascii character will be read and written
incorrectly in UTF-8, creating an ambiguous encoding.
This can be fixed with (see `Comment 1' in
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196447):

:se fe=iso-8859-1

in command mode. But this implies that, for each file, the encoding must be
first checked by the user.

>From FreeBSD's vi(1) manpage:

fileencoding, fe [auto detect]
	     Set the encoding of the current file.

Here, `auto detect' maybe means that vi(1) should automatically switch its
internal encoding according to the current file. So, when this does not
happen, should it be considered a bug? Or is this desired, for some reason?

In Linux Ubuntu's vi(1), for example, the encoding is automatically set,
based on the file.

Bye!

Rocky


More information about the freebsd-questions mailing list