(character) Conversion error (in vi) ?

Yuri Pankov ypankov at fastmail.com
Sun May 17 00:15:50 UTC 2020

Yuri Pankov wrote:
> Ronald F. Guilmette wrote:
>> In message <06696e14-e7e5-f212-4ef0-b89e7e78cde5 at fastmail.com>,
>> Yuri Pankov <ypankov at fastmail.com> wrote:
>>> I'm interested in more details on this as I could be somewhat involved
>>> (see PR 202290).  What release did you upgrade from/to?  Could you
>>> provide a simple test case that shows the issue?
>> Yuri,
>> I've just read PR 202290 and I have added to it a one line attachment
>> which is a test case that demonstrates the issue/problem I have been
>> experiencing, which sounds like it is most probably the same issue
>> as in PR 202290.  (But I would like your opinion on that.)
>> The test case is just a From: line from am email sent to me by a
>> european correspondant of mine.  (Note that I use NHM as a mail
>> client, and that it in turn invokes vi to edit new outbound
>> messages and replies, which is where I frequently encounter this
>> issue/problem.)
>> I'm too embarassed to tell you what versions of FreeBSD I last did
>> an upgrade from.  Let's just say that it was certifiably ancient.
>> My last full upgrade was to 12.0-RELEASE and that date on my local
>> vi is as follows:
>> -r-xr-xr-x  6 root  wheel  461872 Dec  6  2018 /usr/bin/vi
>> I guess that I simply need to upgrade that in order to get your
>> fix for this issue (?)
>> (Yes, I tend to be altogether too lax in keeping this particular
>> system upgraded.)
> No, it's not that bug after all.  The issue is that (n)vi now (for quite 
> some time :-) defaults to UTF-8 when it can't reliably detect the file 
> encoding, so you'll just have to help it a bit adding the following to 
> ~/.nexrc:
> set fileencoding=iso8859-1
> This way (n)vi will check if file encoding looks like UTF-8, and if not, 
> it will use ISO8859-1 as fallback.

For the sake of correctness, re-reading the code, my reply was not 
entirely precise: (n)vi first checks if file is valid UTF-8, and if it 
isn't and fallback encoding (as shown above) is not set, uses your 
locale's encoding which I guess is UTF-8, hence failing.

More information about the freebsd-questions mailing list