Tobias Herp wrote:
"A.J.Mechelynck" <[EMAIL PROTECTED]> wrote:
Tobias Herp wrote:
I' struggling for quite a while now to get the character encoding right;
What does your Vim say on this file in reply to
:verbose set enc? fenc? fencs?
?
encoding=latin1
fileencoding=
fileencodings=ucs-bom
-- To set 'fileencoding' to something else than what Vim would normally
expect, use the ++enc option to :edit, see ":help ++opt".
Doing a ":e ++enc=utf8 %" helped, thanks!
When opening the file from the commandline, gvim "+set enc=utf8" {filename}
works (tested on Windows)
-- To force recognition of a file as Unicode (e.g., UTF-8), use
":setlocal bomb" on it; then check that 'fileencoding' is setlocal'ed to
some Unicode encoding (such as utf-8) and save.
This didn't work for me.
-- To force recognition of a file as not UTF-8 but Latin1 (assuming
'fileencodings' [plural] is set to "ucs-bom,utf-8,latin1"), put a number
of upper-ASCII bytes (bytes >127) near the beginning, maybe in a
comment. If the file is a text file, you can also use it as "weird
underlining" (e.g. underline your main title with a row of ££££
(pounds
sterling) or of Danish ØØØØ (slashed O's); then ":setlocal
fenc=latin1"
and save. The following works well in one of my text files:
-----------------------------------------
# zim: set fenc=latin1 nomod : £££££µµµµµ
# "zim" (not "vim") above is intentional
-----------------------------------------
I didn't understand this "dirty little trick" completely. Is the "set fenc=latin1
nomod" of any relevance, then, except as a reminder?
It's just a reminder: by changing zim to vim the line would be a Vim
"modeline", but this way Vim doesn't take it as such; what does the
trick is the ££££µµµµ comment (whose bytes, as encoded in Latin1, are
illegal in UTF-8 and thus trigger the "reject" side of Vim's UTF-8
encoding-recognition algorithm). Any string of repeated bytes in the
range 128-255 would work just as well IIUC. I wrote a tip at vim-online
a few days ago about this trick:
http://vim.sourceforge.net/tips/tip.php?tip_id=1288
see
:help modeline
:help 'fileencodings'
:help 'fileencoding'
:help 'encoding'
:help encoding-table
Anyway, I finally inserted a line
set fencs=ucs-bom,utf-8,latin1
into my _vimrc file, and everything seams to work fine now. Thanks a lot!
My pleasure.
Best regards,
Tony.