[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

file-attribute on certain Chinese filenames failed

From: MJ Chan
Subject: file-attribute on certain Chinese filenames failed
Date: Wed, 07 Feb 2007 05:51:04 -0800 (PST)

I had trouble in accessing some files that contains certain Chinese
(big5) characters (in fact, I found only one character so far that is
causing the problem; all others are good). After checking around, I
found that the problem would take place in "lstat" call in the C
source. One example is in "file-attributes" (src/dired.c).

For example, if I created a file named "=26345" (see below for the
"describe-char" on that particular Chinese character) and then
evaluated this, it returned nil. 

(file-attributes "=26345")

As mentioned above, the culprit seems to be in calling lstat with
encoded version of the file name as shown below (taken from dired.c)

  GCPRO1 (filename);
  encoded = ENCODE_FILE (filename);

  if (lstat (SDATA (encoded), &s) < 0)

    return Qnil;

If I changed the call to use un-encoded filename (i.e. lstat
(filename,...)), then it is good. But I am not sure if this is the
right thing to do. 

BTW, file-name-coding-system is big5 in my setup.

  character: =26345 (156485, #o461505, #x26345, U+6703)
    charset: chinese-big5-1 (Frequently used part (A141-C67F) of Big5 (Chinese 
 code point: #x46 #x45
     syntax: w  which means: word
   category: C:Chinese (Han) characters of 2-byte character sets c:Chinese
             |:While filling, we can break a line at this character.
buffer code: #x98 #xC6 #xC5
  file code: not encodable by coding system undecided-unix
    display: by this font (glyph code)
     -outline-mingliu-normal-r-normal-normal-12-90-96-96-c-*-big5-* (#x6703)

There are text properties here:
  fontified            t


In GNU Emacs (i386-mingw-nt5.1.2600)
 of 2006-08-08 on T40
X server distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.2) --cflags -I../../GnuWin32/include'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  locale-coding-system: chinese-big5
  default-enable-multibyte-characters: t

Major mode: MSpools

Minor modes in effect:
  auto-image-file-mode: t
  shell-dirtrack-mode: t
  encoded-kbd-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
C-p C-p C-p q y <help-echo> <help-echo> <down-mouse-1> 
<mouse-1> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> M-x v m <return> y i C-x 1 
C-n C-n C-n C-n C-n C-n C-n . n d SPC SPC b SPC d x 
M-x m s p <tab> <return> g C-n <return> i n d d d d 
q g <help-echo> M-x s u b m i <tab> t <tab> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
r e p o r t <tab> <return>

Recent messages:
Saving file c:/home/mjchan/Mail/Spam...
Wrote c:/home/mjchan/Mail/Spam
Sorting for index file...
Stuffing index file...
Writing index file...
Wrote c:/home/mjchan/Mail/Spam.idx
Writing index file... done
 [8 times]
Loading emacsbug...done

reply via email to

[Prev in Thread] Current Thread [Next in Thread]