Herouth Maoz wrote on 2003-07-27:

> As for vi, I'm a bit mystified about this myself - I removed UTF8 from every
> localization file in my system, and still vi opens up with a default file
> encoding of utf8.
>
> Each program has its own behaviour, however. Take vi - it has an encoding, and
> then, a file encoding. As it is, I changed the encoding to iso8859-8 in its
> vimrc. So when it reads a plain ascii file it assumes a file encoding of utf-8
> and does a (useless) conversion. If, however, the file contains Hebrew
> characters in ISO8859-8, it interprets it as an unknown encoding, and loads it
> up just fine... Each program has such quirks.
>
Wild guess: vi is trying to autodetect UTF-8.  The probability of a
file in non-ascii encoding other than UTF-8 to be decodable as valid
UTF-8 is very low (except for extremely short text or texts with very
few non-ascii characters).  Some programs use this to autodetect
UTF-8: no matter what's your locale they first try UTF-8 and only if
it doesn't decode correctly they fall back on the locale's defaul
encoding.  In the case you decribe, a file with no hebrew letters is a
valid ASCII file and therefore a valid UTF-8 file, so vi decides it
was UTF-8.  Being pure ASCII, it would load the same in any encoding
but I guess you are upset by it also deciding to save it as UTF-8 even
after you add hebrew characters.  Again, I'm wildly guessing as I
don't even use vi.  Most probably this autodetection can be disabled,
try to look in vi's systemwide configuration files in addition to your
personal one...

-- 
Beni Cherniavsky <[EMAIL PROTECTED]>

If I don't hack on it, who will?  And if I don't GPL it, what am I?
And if it itches, why not now?  [With apologies to Hillel ;]

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to