On Jan 21, 11:41 am, Tony Mechelynck <[EMAIL PROTECTED]> wrote: > Linxiao wrote: > > This is vim-dev maillist, better sending your question to [EMAIL PROTECTED] > > . > > > PS. If you wanna save a UTF-8 content file, just :set fenc=utf-8 but > > not enc=utf-8. > > > Good Luck! > > Tt, tt, tt... If 'encoding' is other than UTF-8 (or GB18030), Vim cannot > represent all Unicode codepoints in memory; therefore, if you try to edit a > UTF-8 file you run the risk of losing part of the data. (If you set 'enc' to > UTF-16, UCS-2 or UCS-4 aka UTF-32, with any endianness, what Vim will use is > actually UTF-8.) > > To edit UTF-8 data you should have both 'encoding' (= memory representation of > the data) and 'fileencoding (= disk representation of the data) set to UTF-8. > > > Best regards, > Tony.
Thanks! I tried these: D:\test>gvim :set fenc=utf-8 :set enc=utf-8 :e 测试.txt E37: No write since last change (add ! to override) :e! 测试.txt :set fenc? fileencoding=utf-8 :set enc? encoding=utf-8 It is all-right. Note that in the above test I opened gvim with an empty buffer first. Another test shows some problems that I should take care: D:\test>gvim 测试.txt :set fenc? fileencoding= :set enc? enc=cp936 Of course, under this situation the file contents are in a wrong encoding. Then I tried these: :set enc=utf-8 After this, the window title has changed to: <b2><e2><ca><d4>.txt (D:\test) - GVIM :set fenc? fileencoding= :set enc? encoding=utf-8 I proceed with: :e The window title became: <b2><e2><ca><d4>.txt = (D:\test) - GVIM :set fenc? fileencoding=utf-8 :set enc? encoding=utf-8 However as I observed, the file name of the .swp file is still .测试.txt.swp. To make the window title correct and make the file non-read-only (writable), I typed: :e 测试.txt A new buffer is opened and the window title changed back to the original: 测试.txt = (D:\test) - GVIM Now every write to the file is OK. However after exiting gvim, the swap file is still there. Sorry for writing this long, just for some reference. I've read the help for `fencs', but I did't find it helpful to this situation. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
