On Wed, 12 Apr 2006, Benji Fisher wrote:

> On Tue, Apr 11, 2006 at 04:47:52PM +0100, Hugh Sasse wrote:
> > 
> > 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

Just a heuristic.  I've not seen the full 16 bits used yet, except for
the BOM.  Obviously if I use something other than English that's more likely.

> 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

agreed.

> :set bomb     " I think this will be set already, but be safe

It only applies to Unicode fileencoding anyway, so that's OK in the vimrc.
> :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&

That would work, but I've seen this with other windows files also, so 
I was after something more widely applicable than '*.reg'. I'll assume
that nothing more automagical is possible for now. 
> 
> I have not tested this.
> 
> HTH                                   --Benji Fisher

        Thank you.
        Hugh
> 

Reply via email to