Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 May 2020 20:26:51 -0700
From:      "Ronald F. Guilmette" <rfg@tristatelogic.com>
To:        Yuri Pankov <ypankov@fastmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: (character) Conversion error (in vi) ?
Message-ID:  <72851.1589686011@segfault.tristatelogic.com>
In-Reply-To: <910485e6-a5bf-8da1-55bb-2bc632d657e3@fastmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message <910485e6-a5bf-8da1-55bb-2bc632d657e3@fastmail.com>, 
Yuri Pankov <ypankov@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?72851.1589686011>