(character) Conversion error (in vi) ?

Ronald F. Guilmette rfg at tristatelogic.com
Sun May 17 03:26:53 UTC 2020


In message <910485e6-a5bf-8da1-55bb-2bc632d657e3 at fastmail.com>, 
Yuri Pankov <ypankov at fastmail.com> wrote:

>> 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.

I am far from knowledgable when it comes to content encoding &
character sets generally, but it would seem to me that if the
fallback is the same as the encoding that was already tried
and failed, then this simple-minded fallback strategy may
perhaps be sub-optimal.


Regards,
rfg


More information about the freebsd-questions mailing list