Loading ...
Sorry, an error occurred while loading the content.

2449Re: Unicode conversion bug?

Expand Messages
  • Tony Mechelynck
    Mar 12, 2008
      Mansing wrote:
      > Thanks Tony for the advice. More details on my problem:
      >
      > I am using gVim on Windows Vista Business which has full (normal)
      > Chinese support. I set "enc=ucs-2le" and "fenc=utf-8" for conversion
      > (saving to utf-8 format); I use the "Save As" menu option to do the same
      > on Notepad. The (ucs-2le) input file was displayed correctly on gVim
      > with guifont "MingLiU".
      >
      > To examine the output files, I set "enc=utf-8" and the guifont to
      > "MingLiU", for both cases. The utf-8 file converted by Notepad was
      > displayed correctly, while that by gVim wasn't. The hex dumps, for both
      > output files, were copied from the gVim window after ":%!xxd".
      >
      > mt 2008-03-12

      Try the following after starting gvim afresh (lines starting with a
      double-quote are comments; you don't need to type them)

      :if &tenc == "" | let &tenc = &enc | endif
      :set enc=utf-8 fencs=ucs-bom,utf-8,utf-16le,latin1
      :set gfn=MingLiU:h16:cDEFAULT
      :e inputfile.txt
      " (the input UCS-2le file). Is it displayed correctly?

      " only if it isn't:
      :e ++enc=utf-16le

      :setlocal fenc=utf-8
      " don't change 'encoding'
      :saveas! outfile.txt
      " the output (UTF-8) file

      :enew
      " to clear the current window
      :e outfile.txt
      " is it displayed correctly now?
      :setlocal fenc?
      " gvim should reply: fileencoding=utf-8

      " if it isn't displayed correctly
      :e ++enc=utf-16le
      :e ++enc=utf-8
      "...etc., until you get it to display correctly

      If it totally doesn't work, retry the above after invoking the editor as

      gvim -N -u NONE

      in a cmd.exe window. You may or may not need to cd to the directory
      containing gvim.exe beforehand.


      Best regards,
      Tony.
      --
      When I was younger, I could remember anything, whether it had happened
      or not; but my faculties are decaying now and soon I shall be so I
      cannot remember any but the things that never happened. It is sad to
      go to pieces like this but we all have to do it.
      -- Mark Twain

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_multibyte" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 25 messages in this topic