Re: Not displaying the large unicode file properly
- View SourceThorsten Maerz wrote:
> On 25.08.2001 at 12:43 Bram Moolenaar wrote:What was happening was that Vim is set to use "latin1", and using a
> >Your file has an error: it ends in 0x0a, instead of 0x0a 0x00. Thus a
> >trailing NUL byte is missing. You can also see it by the file size, which
> >is 493. An ucs-2 files should always be an even byte count.
> >After adding the NUL, I can read this file without problems. Thus I still
> >didn't figure out the real problem with this file.
> After reading the posting from Ron Aaron (vim6 utf-8 and hls display
> problem) and playing with manual encoding setting**, I succeeded first
> time to get a problematic* ucs-2le file converted correctly :
> 1. Open the file in Vim (no conversion, shows raw/single bytes)
> 2. :set enc=utf8 (bom gets displayed as <ff><fe>. seems ok.)
> 3. :e ++enc=ucs-2le (correct encoding. no errors.)
> That way, I can edit (nt2k) ucs-2le coded registry files of any size
> (tested:45 MB) - and other ucs-2le files.
> So this problem seems not to be caused by iconv() or a missing font.
> The file (or Vim) has to be encoded as utf8 first, then it can be converted
> to other (multibyte) encodings.
Unicode file with characters > 0xff would cause loss of information.
Vim then automatically switches off the conversion of Unicode to latin1
and you get the "raw" file.
If you set 'encoding' to "utf-8", this failure can't happen and it works
OK. Thus Vim is doing the right thing, there really was a conversion
error in that file when using "latin1".
> If this is meant to work like that (always preconvert to utf8), IVim doesn't switch to using utf-8 automatically based on what file is
> wonder why this isnt done automatically, when switching from a
> non-multibyte encoding. Otherwise, non converted files may get
> destroyed by Vim (see *).
> HTH editing .reg-files and maybe fix a bug/unconvenient behaviour.
read. Changing 'encoding' has a lot of side effects (e.g., text in
registers may become invalid). I don't think changing 'encoding'
automatically is a good idea.
hundred-and-one symptoms of being an internet addict:
9. All your daydreaming is preoccupied with getting a faster connection to the
net: 28.8...ISDN...cable modem...T1...T3.
/// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
\\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///