On 13/08/07, Benno Schulenberg <[EMAIL PROTECTED]> wrote:
> Mick wrote:
> > Hmm, I just checked a utf-8 file after I edited it and it says:
> >
> > :set encoding
> >  encoding=latin1
> >
> > I assume this means that it was changed from utf8 to latin1
>
> No.  To see what encoding a file has, you could use 'file'.  Run
> 'file thefileyouedited', and it should say "UTF-8 Unicode text".
> When you open the file again with vim, it will say "[converted]" on
> the status line: converted from utf-8 to latin1.

That's what I did first of all, but got this in return:
========================================
$ file Website/sitemap.xml
Website/sitemap.xml: XML
========================================

> Because your LANG isn't set, the default is Latin1, as you could
> have learned by typing ':help enc' in vim.

Thanks for the tip.  The depths of Vim's help pages never cease to amaze me.

> > Do I have to change my locale?
>
> Depends on what you want.  If new files should be UTF-8 encoded,
> then change your locale.  Otherwise you're fine as you are.

Hmm, not sure:  I want to be able to edit text files, which may be
occasionally just ascii, or MS Windows, or UTF-8, without creating any
problems when these are opened at the receiving end.  The above file
was a UTF-8 file before I edited it and Google will spit it out if the
encoding has been changed.

If I understand the autoconversion feature correctly, vim will
open/convert it; then I will edit it in which ever language my locale
is meant to have been set up (latin1); then it will convert/save it
back in UTF-8 . . . unless I have entered in my editing any funny
characters(?).  I believe that in most cases this should be
satisfactory.

Alternatively, I will use e.g.  :set enc utf-8 in Vim and carry on
merrily editing the txt file.

Or, I leave Vim encoding alone and run export LANG="en_GB.UTF-8" and
Vim will use that.

Did I get this right?

PS.  What I am not entirely sure about is where is the locale set for
my system?  When I look into /etc/env.d/ I cannot find the file
02locale.
-- 
Regards,
Mick
-- 
[EMAIL PROTECTED] mailing list

Reply via email to