all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kyotaro HORIGUCHI <horiguti@meadowy.org>
Subject: expand-file-name problem for multibyte string.
Date: Sat, 03 Sep 2005 02:47:29 +0900 (JST)	[thread overview]
Message-ID: <20050903.024729.98935170.horiguti@horiguti.meadowy.org> (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

                 reply	other threads:[~2005-09-02 17:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050903.024729.98935170.horiguti@horiguti.meadowy.org \
    --to=horiguti@meadowy.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.