Peter wrote:
I am using vim over ssh. The remote OS is FreeBSD 6.2 and the local OS
is Kubuntu. Both remote and local shells are bash. So far I can write
French characters in the shell remotely (mkdir, touch) and when using
vim I can write some characters but when I open the file again with vim
some words are messed up (some letters, even non-French) are
missing. Also when I try to correct the French words it is difficult;
vim takes one French character as taking up two characters or I erase
one character to only have it replaced by a different character. Can
anyone help?
PM
1. Most of the following applies only to Vim versions with multi-byte
(actually, multi-encoding) support:
:echo has("multi_byte")
should return 1.
2. Make sure that your 'encoding' supports all the characters you need.
See:
:help 'encoding'
:help encoding-names
3. Make sure that your 'termencoding' is set to what your keyboard sends and,
in Console Vim, to what your terminal screen understands. The default
'termencoding' value is the empty string, meaning "use 'encoding'", which is
usually OK at startup, but not if you change 'encoding'. Here is a scriptlet
to (for instance) set 'encoding' to Unicode:
if has("multi_byte")
if &enc !~? '^u' " if already Unicode, no need to change it
if &tenc == ""
" don't clobber the keyboard encoding
let &tenc = &enc
endif
set enc=utf-8
endif
" heuristics for existing files
set fencs=ucs-bom,utf-8,latin1
" defaults for new files
setglobal bomb fenc=latin1
else
echomsg "Warning: multibyte support not compiled-in"
endif
See
:help 'termencoding'
3. Make sure that the file's 'fileencoding' is set buffer-locally to the right
value.
See:
:help 'fileencoding'
:help 'fileencodings'
:help ++opt
4. Some characters may be absent from your keyboard. In that case, you may
want to use either digraphs, or the "accents" keymap.
See:
:help digraph.txt
:help mbyte-keymap
Best regards,
Tony.
--
"The bad reputation UNIX has gotten is totally undeserved, laid on by
people who don't understand, who have not gotten in there and tried
anything."
-- Jim Joyce, owner of Jim Joyce's UNIX Bookstore