On Tue, Aug 14, 2007 at 08:38:38AM +0200, Penguin Lover Michal 'vorner' Vaner 
squawked:
> Hello
> 
> On Mon, Aug 13, 2007 at 10:42:17PM +0100, Mick wrote:
> > Hmm, I just checked a utf-8 file after I edited it and it says:
> > 
> > :set encoding
> >  encoding=latin1
> 
> I would guess your UTF-8 file has no accents, or other characters. In
> other words, it can be considered pure ASCII, which means Vim can safely
> assume it is latin1 encoded text - there is no difference no matter
> which reasonable encoding it chooses. (The encoding is not saved in the
> file, it is guessed from what is saved there)

Uh, that's not exactly correct.

encoding is the value assumed from LANG that the buffer uses: it is
the encoding of the terminal you are using, and how you enter text and
how the buffer should be displayed on the screen. 

fileencoding (:help fenc) is what determines how the files should be
saved to disk. It is automatically guessed by vim based on the file
in question and the variable fileencodings. 

Only when vim cannot guess what encoding the file originally was (in
which case fenc is the empty string), or when you start editing a new
file without specifying fenc, will vim actually convert and save the
file using the encoding specified in the enc variable. Given that the
default vim install on gentoo has "utf8" among the fileencodings
options, vim should correctly detect a utf8 file as such, and even
though you are editing it in a latin1 environment, convert it back to
utf8 on save. 

W
-- 
Statistics are like a Bikini: 
  showing interesting details but hiding the important stuff.
Sortir en Pantoufles: up 250 days, 19:22
-- 
[EMAIL PROTECTED] mailing list

Reply via email to