Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Apr 2019 19:14:49 +0200
From:      "Rocky Hotas" <rockyhotas@post.com>
To:        "FreeBSD Questions" <freebsd-questions@freebsd.org>
Subject:   vi(1) and ISO 8859-1
Message-ID:  <trinity-f25766ad-e745-4e70-98d1-52c0ba83fe56-1554398089214@3c-app-mailcom-lxa05>

Next in thread | Raw E-Mail | Index | Archive | Help
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



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?trinity-f25766ad-e745-4e70-98d1-52c0ba83fe56-1554398089214>