vi(1) and ISO 8859-1

Matthias Apitz guru at unixarea.de
Fri Apr 5 05:18:41 UTC 2019


El día Thursday, April 04, 2019 a las 11:59:24PM +0200, Rocky Hotas escribió:

> It completes successfully, exit status is 0. You can easily create such a
> file and reproduce this: just open vi(1), set the encoding with
> `:se fe=iso-8859-1', and just type a letter with an accent, like:

I have to use ':set fileencoding=iso-88591' and with that I produced the
file file-iso-8859-1.txt as:

$ cat file-iso-8859-1.txt
¡Viva la Revolución!

$ od -c file-iso-8859-1.txt
0000000  241   V   i   v   a       l   a       R   e   v   o   l   u   c
0000020    i 363   n   !  \n                                            
0000025

As you see, the non ASCII chars are coded in ISO.

I reloaded it with 'vim file-iso-8859-1.txt' without setting the
encoding, added some more chars and wrote it back as:

$ od -c file-iso-8859-1.txt
0000000  241   V   i   v   a       l   a       R   e   v   o   l   u   c
0000020    i 363   n   !  \n 241   V   i   v   a       l   a       R   e
0000040    v   o   l   u   c   i 363   n   !  \n                  
0000052

and all was fine.

This is with vim 8.1.555 on 

$ uname -a
FreeBSD c720-r342378 13.0-CURRENT FreeBSD 13.0-CURRENT GENERIC  amd64

-- 
Matthias Apitz, ✉ guru at unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
70 years of NATO - 70 years of wars (Jugoslavia, Afghanistan, Syria, ...) and 70 years
of war preparation against Russia.  -- PEACE instead of NATO !


More information about the freebsd-questions mailing list