Damir Zucic wrote:
> Hi everybody,
> I have just recently installed my new linux box. It runs openSUSE 10.2,
> and I have upgraded vim to version 7.0.243 .
> Before, I have used older vim versions (6 and older).
> In the past I have used <ctrl-v><decimal_number> to insert special
> characters (there are five uppercase and five lowercase exotic characters in
> Croatian language). A single byte was used to store each of these characters.
> However, in version 7 two bytes are used to store each of them! I don't know
> how to fix this problem. The value of LANG variable is en_US.UTF-8 and
> encoding is not mentioned in my vimrc file. Decimal values of these exotic
> characters are 200, 232, 198, 230, 208, 240, 169, 186, 174 and 190.
> Now 200 is replaced with two bytes: 195 and 136 (decimal) etc.
> The command :digraphs works fine and lists digraphs using iso-8859-1, I guess.
> The command :set encoding shows that encoding is utf-8 .
> Normally, we use the code page ISO-8859-2 here in Croatia.
> What can I do to force vim to use a single byte to store exotic character?
> Best regards,
> Damir Zucic
The fact that two (or more) memory bytes are used to store characters other
than 0x00 to 0x7F is normal; it's part of the definition of UTF-8.
To save your data on disk in such manner that each character occupies only one
disk byte, set 'fileencoding' appropriately for your files. You will see
[converted] when reading and writing ISO_8859-2 files, but again, this is
normal, since Vim uses UTF-8 internally to represent the data in memory.
See also the second "NOTE" paragraph under ":help 'encoding'".
You may want to add the following to your vimrc:
if &encoding !~? '^u' " if not Unicode, let's set it
if &termencoding == ''
let &termencoding = &encoding " save the keyboard layout
set fileencodings=ucs-bom,utf-8,iso-8859-2 " encoding-detect heuristics
setglobal bomb " for new Unicode files
setglobal fileencoding=iso-8859-2 " default for new files
The First Commandment for Technicians:
Beware the lightening that lurketh in the undischarged
capacitor, lest it cause thee to bounce upon thy buttocks in a most