On Tue, Apr 11, 2006 at 04:47:52PM +0100, Hugh Sasse wrote:
> On Tue, 11 Apr 2006, Benji Fisher wrote:
> > 
> > :set enc=utf-8
> > :e ++enc=ucs-2le regfile.reg
> 
> Yes, this worked.  I didn't know about ++enc which I see overrides enc
> (encoding).  For others reading this: having opened the file I didn't
> need the filename to reopen it.
>  :e ++enc=ucs-2le
> did the job.
> > 
> > If I leave 'encoding' set to latin1 (the default), then I get a message
> > "[CONVERSION ERROR]" when I load the file.
> > 
> > HTH                                 --Benji Fisher
> 
> Yes.  Is there something I can set that will make the encoding ucs-2le when
> every alternate char is a null (apart from the "bom[b]")?  Maybe there's a 
> reason to not do that?

     Unfortunately, there is no reliable way to detect the file's
encoding.  (I do not think that "every alternate char is a null" is
really what is going on.)  That is the idea of the BOM, but apparently
regedit does not set one.

     One thing that might help is to :set enc=utf-8 in your vimrc file;
then

:e ++enc=ucs-2le
:set bomb       " I think this will be set already, but be safe
:w

I think the next time you open the file in gvim, it will recognize the
BOM and set 'fenc' automatically.

     Another thing that might help is to add the lines

:set enc=utf-8
:au BufReadPre *.reg set fencs=ucs-2le
:au BufReadPost *.reg set fencs&

I have not tested this.

HTH                                     --Benji Fisher

Reply via email to