all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* expand-file-name problem for multibyte string.
@ 2005-09-02 17:47 Kyotaro HORIGUCHI
  0 siblings, 0 replies; only message in thread
From: Kyotaro HORIGUCHI @ 2005-09-02 17:47 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-09-02 17:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-02 17:47 expand-file-name problem for multibyte string Kyotaro HORIGUCHI

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.