bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#13515: 24.3.50; file-name operating functions are broken on Japanese


From: Eli Zaretskii
Subject: bug#13515: 24.3.50; file-name operating functions are broken on Japanese Windows
Date: Wed, 23 Jan 2013 18:21:16 +0200

> Date: Wed, 23 Jan 2013 18:38:23 +0900
> From: Kazuhiro Ito <kzhr@d1.dion.ne.jp>
> Cc: 13515@debbugs.gnu.org
> 
>  > > In addition, that change also let the below code fail.
>  > > 
>  > > (let ((file-name-coding-system 'cp1252))
>  > >   (expand-file-name "漢字" "C:/"))
>  > > 
>  > > -> "c:/  "
>  > 
>  > IMO, this snippet doesn't make sense and cannot be supported.
>  > expand-file-name calls a number of system APIs which need the file
>  > name be encoded, so using file-name-coding-system that cannot possibly
>  > encode a file name is not supposed to work.
>  > 
>  > Do you have a real-life situation where such cases emerge and need to
>  > be supported?
> 
>  None for me, sorry for inappropriate example.  But the docstring of
>  w32-downcase-file-names says it affects remote file names and the fix
>  for Bug#12933 also affects other functions without using system APIs
>  (e.g., file-name-directory).

On Windows, file-name-directory and similar functions do call system
APIs, for 2 reasons: (1) down-casing file names under
w32-downcase-file-names, and (2) advancing by characters in DBCS
locales, which can only be supported if file-name-coding-system is one
of the codepages known to Windows.

> I guess it would be better that these functions (except ones using
>  system APIs) didn't depend on codepage.  Does Emacs neither support
>  the below code?
> 
>  (let ((file-name-coding-system 'cp1252))
>    (file-name-directory "漢字/"))
> 
> -> "  /"

Well, "漢字/" is not a remote file name, so it is still subject to the
limitation that only file names that can be encoded by the
file-name-coding-system are supported.  But even using a remote file
name, such as "/foo@bar.com:漢字/", gets butchered by
file-name-directory.  However, this is a much broader issue, related
to Tramp and to other non-Windows specific aspects of file-name
handling, so I will start a discussion about that on emacs-devel.
Thanks for bringing up this point.





reply via email to

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