barbaz
barbaz

Reputation: 1712

Is there any way to handle ISO-8859-16 / latin10 encoded files in vim?

From the help page section encoding-values:

Supported 'encoding' values are:            *encoding-values*
1   latin1  8-bit characters (ISO 8859-1, also used for cp1252)
1   iso-8859-n  ISO_8859 variant (n = 2 to 15)
[...]

Somehow, it seems that ISO-8859-16 / latin10 was left out? I fail to read files with that encoding correctly. Am I overlooking anything? If not, can I somehow add support for this character encoding to vim through a plugin or so?

Upvotes: 0

Views: 600

Answers (2)

Attila
Attila

Reputation: 170

On Windows, my version of Vim is compiled with +iconv/dyn. According to the Vim documentation:

On MS-Windows Vim can be compiled with the +iconv/dyn feature. This means Vim will search for the "iconv.dll" and "libiconv.dll" libraries. When neither of them can be found Vim will still work but some conversions won't be possible.

The most recent version from the DLL from here http://sourceforge.net/projects/gettext/files/libiconv-win32/ seems to do job for me. Without it I could not convert most iso-8859 encodings other than iso-8859-1. Having iconv.dll installed I can load the files easily with:

:e ++enc=iso-8859-16 file.txt

Upvotes: 1

Ingo Karkat
Ingo Karkat

Reputation: 172520

If Vim cannot handle it, you can convert to (for example) UTF-8) with the iconv tool:

$ iconv --from-code ISO-8859-16 --to-code UTF-8 -o outputfile inputfile

Upvotes: 0

Related Questions