emacs-devel
[Top][All Lists]
Advanced

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

expand-file-name problem for multibyte string.


From: Kyotaro HORIGUCHI
Subject: expand-file-name problem for multibyte string.
Date: Sat, 03 Sep 2005 02:47:29 +0900 (JST)
User-agent: Mew version 4.2.53 on Emacs 22.0 / Mule 5.0 (SAKAKI) / Meadow-3.00-dev (KIKU)

I've just found that expand-file-name returns unibyte string when
name is unibyte, ignoring whether default-directory is multibyte
or not.

(expand-file-name "file" "/home/horiguti/À") => "/home/horiguti/\201\300/file"

(expand-file-name "fileÀ" "/home/horiguti/a") => "/home/horiguti/a/fileÀ"
(expand-file-name "fileÀ" "/home/horiguti/À") => "/home/horiguti/À/fileÀ"

The cause of this is that expand-file-name uses only NAME to
determine the bytewidth of the return string. But
DEFAULT-DIRECTORY is also needed. Attached patch fixes the bug,
but I confirmed it only on GNU/Linux and MS-Windows.

-- 
Kyotaro HORIGUCHI


--- fileio.c    07 8 2005 12:33:16 +0000        1.552
+++ fileio.c    02 9 2005 16:35:19 +0000        
@@ -1299,7 +1299,8 @@
            {
              nm = sys_translate_unix (nm);
              return make_specified_string (nm, -1, strlen (nm),
-                                           STRING_MULTIBYTE (name));
+                                   STRING_MULTIBYTE (name)
+                                   || STRING_MULTIBYTE (default_directory));
            }
 #endif /* VMS */
 #ifdef DOS_NT
@@ -1331,7 +1332,8 @@
          if (nm == SDATA (name))
            return name;
          return make_specified_string (nm, -1, strlen (nm),
-                                       STRING_MULTIBYTE (name));
+                               STRING_MULTIBYTE (name)
+                               || STRING_MULTIBYTE (default_directory));
 #endif /* not DOS_NT */
        }
     }
@@ -1709,7 +1711,8 @@
 #endif /* DOS_NT */
 
   result = make_specified_string (target, -1, o - target,
-                                  STRING_MULTIBYTE (name));
+                                  STRING_MULTIBYTE (name)
+                                  || STRING_MULTIBYTE (default_directory));
 
   /* Again look to see if the file name has special constructs in it
      and perhaps call the corresponding file handler.  This is needed





reply via email to

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