Re: R: Vim doesn't open files with chinese file names

2006-06-13 Thread Wu Yongwei

On 6/11/06, Wu Yongwei [EMAIL PROTECTED] wrote:

On 6/11/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:
 Cesar Romani wrote:
 
  -Messaggio originale-
  Da: A.J.Mechelynck [mailto:[EMAIL PROTECTED]
  Inviato: venerdì 9 giugno 2006 23.34
  A: Cesar Romani
  Cc: Vim
  Oggetto: Re: Vim doesn't open files with chinese file names
 
  Cesar Romani wrote:
 
  If I have a file with a chinese file name, f.e. 感情包袱.txt
  It won't open but it throws the message: E303: Unable to open swap file
 
  for
 
  .txt, recovery impossible
 
  Instead with notepad I can open the file.
 
  Many thanks in advance,
 
  Andalou
 
 
 
 
 
  Is your Vim version compiled with +multi_byte ? (:echo has(multi_byte)
  should return 1). The multi-byte feature is also mentioned in the
  :version text as one of +multi_byte, +multi_byte_ime or
  +multi_byte_ime/dyn
 
  If yes, check near the bottom of the :version text the name of the
  compiler: Vim binaries compiled with BCC32 have been notorious in the
  past for bad support of multi-byte characters, especially in filenames;
  IIUC, other compilers such as gcc and (don't remember the compiler
  executable name) MS Visual C have less problems in that respect. (I
  could be wrong though; I don't use non-Latin1 filenames and only very
  rarely non-7-bit-ASCII ones.)
 
  If has(multi_byte) is nonzero and it wasn't compiled with BCC32 then I
  don't know what it is -- maybe a bug. In this case, a makeshift
  workaround (until Bram fixes it) would be to rename the file back and
  forth to something with only 7-bit ASCII in the name.
 
  Normally, E303 means the swapfile can't be opened; but you should still
  be able to edit the file itself, unless it is very large. But you won't
  get a recovery option if Vim crashes, so don't forget to save your work
  extra often.
 
  Oh, and you are using a recent version of Vim aren't you? A year or two
  ago Vim just couldn't handle filenames with multibyte characters in
  them, but I thought that bug had been fixed.
 
 
  Best regards,
  Tony.
 
 
  Thanks for your answer,
  I use the vim 7.0 compiled with MS Visual C and it has multibyte.
  echo has(multi_byte) return 1.
  The file won't be opened and can't be edited even though the file is small.
  All what I get is an empty file.
  If I rename the file with ASCII, even with accented file name it will be
  opened. But notepad can open and edit it.
 
  Many thanks in advance,
 
  Andalou

I now see the problem. You code page is not 936, right? Vim seems only
able to open files with names that are valid in the current code page,
as are many other applications that do not use the Unicode version of
Windows APIs. This is an OS-related issue. You should not have such
problems when the system locale uses UTF-8, such as modern Linux
distros.


One correction. This failure only occurs on the command line. :set
encoding=utf-8, and you can open the file with :e successfully.

--
Wu Yongwei
URL: http://wyw.dcweb.cn/


Re: R: Vim doesn't open files with chinese file names

2006-06-10 Thread Wu Yongwei

On 6/11/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Cesar Romani wrote:

 -Messaggio originale-
 Da: A.J.Mechelynck [mailto:[EMAIL PROTECTED]
 Inviato: venerdì 9 giugno 2006 23.34
 A: Cesar Romani
 Cc: Vim
 Oggetto: Re: Vim doesn't open files with chinese file names

 Cesar Romani wrote:

 If I have a file with a chinese file name, f.e. 感情包袱.txt
 It won't open but it throws the message: E303: Unable to open swap file

 for

 .txt, recovery impossible

 Instead with notepad I can open the file.

 Many thanks in advance,

 Andalou





 Is your Vim version compiled with +multi_byte ? (:echo has(multi_byte)
 should return 1). The multi-byte feature is also mentioned in the
 :version text as one of +multi_byte, +multi_byte_ime or
 +multi_byte_ime/dyn

 If yes, check near the bottom of the :version text the name of the
 compiler: Vim binaries compiled with BCC32 have been notorious in the
 past for bad support of multi-byte characters, especially in filenames;
 IIUC, other compilers such as gcc and (don't remember the compiler
 executable name) MS Visual C have less problems in that respect. (I
 could be wrong though; I don't use non-Latin1 filenames and only very
 rarely non-7-bit-ASCII ones.)

 If has(multi_byte) is nonzero and it wasn't compiled with BCC32 then I
 don't know what it is -- maybe a bug. In this case, a makeshift
 workaround (until Bram fixes it) would be to rename the file back and
 forth to something with only 7-bit ASCII in the name.

 Normally, E303 means the swapfile can't be opened; but you should still
 be able to edit the file itself, unless it is very large. But you won't
 get a recovery option if Vim crashes, so don't forget to save your work
 extra often.

 Oh, and you are using a recent version of Vim aren't you? A year or two
 ago Vim just couldn't handle filenames with multibyte characters in
 them, but I thought that bug had been fixed.


 Best regards,
 Tony.


 Thanks for your answer,
 I use the vim 7.0 compiled with MS Visual C and it has multibyte.
 echo has(multi_byte) return 1.
 The file won't be opened and can't be edited even though the file is small.
 All what I get is an empty file.
 If I rename the file with ASCII, even with accented file name it will be
 opened. But notepad can open and edit it.

 Many thanks in advance,

 Andalou


I now see the problem. You code page is not 936, right? Vim seems only
able to open files with names that are valid in the current code page,
as are many other applications that do not use the Unicode version of
Windows APIs. This is an OS-related issue. You should not have such
problems when the system locale uses UTF-8, such as modern Linux
distros.

--
Wu Yongwei
URL: http://wyw.dcweb.cn/