Thursday, May 19, 2016

Re: Reproducible issue reading large registry file

On Fri, May 20, 2016, Eric Christopherson wrote:
> On Thu, May 19, 2016, 'Suresh Govindachar' via vim_use wrote:
> >
> > Steps to reproduce issue:
> >
> > System: Windows 7 64 bit
> >
> > Gvim: VIM - Vi IMproved 7.4 (2013 Aug 10,
> > compiled Jan 2 2016 14:36:11)
> > MS-Windows 32-bit GUI version with OLE support
> > Included patches: 1-1023
> > Compiled by mool@tororo
> > Big version with GUI.
> >
> > 1) Export entire registry to file (in my case, about 500 MBytes)
>
> How are you exporting it? From within regedit's GUI? Or by invoking
> regedit on the command line?
>
> >
> > 2) gvim.exe -u NONE -U NONE --noplugin all_reg.reg
> >
> > 3) takes some time and then get message just before file shows up
> >
> > 4) Observe message before file shows up: "all_reg.reg" [Incomplete last
> > line][unix format] 3912091 lines, 523120802 characters
> > Press ENTER or type command to continue
> >
> > 5) Hit enter
> >
> > 6) Observe contents of buffer:
> >
> > ÿ[with two dots on the top of it]þ[funny looking p]W^@i^@n^@d^@o^@w^@s
> >
> > [more such triples: @<readable letter>^]
> >
> > 7) Open all_reg.reg in notepad++: no issues, file opens very quickly, text
> > is clearly seen.
> >
> > Please look into this.
>
> As Tim said, this looks just like a UTF-16 file (specifically
> little-endian, with a BOM) being opened as if it were in another
> encoding. The only weird things to me are that it's in Unix format
> instead of DOS (=Windows), and it has "Incomplete last line". I've been
> successful at turning a registry text file into one such as you
> describe, but it only seems to happen if I resave the file from within
> Vim, and it probably depends on a few options being set. When I open a
> registry text file from Vim before I've modified the file at all, it
> opens correctly.
>
> Try this -- a small elaboration on what Tim said:
> After opening the file, issue:
> :e ++enc=utf-16le ++ff=dos
>
> Or you can do it from the command line with
> vim ++enc=utf-16le ++ff=dos all_reg.reg

Sorry, I messed that up. It should be:
vim -c '++enc=utf-16le ++ff=dos all_reg.reg'

>
> The only difference from Tim's recommendation is that we're telling it
> to use DOS line endings, since it seems to incorrectly pick Unix ones.

Another correction: this also differs from Tim's in that it specifies
specifically little-endian UTF-16.

> (Then again, maybe you accidentally saved the file from within Vim and
> thereby caused it to save with Unix line endings, in which case leave
> off the ++ff=dos part.)
>
> --
> Eric Christopherson

--
Eric Christopherson

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: