all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Kazuhiro Ito <kzhr@d1.dion.ne.jp>, emacs-devel@gnu.org
Subject: Re: Multibyte and unibyte file names
Date: Wed, 23 Jan 2013 20:42:55 +0100	[thread overview]
Message-ID: <87mwvz1y9s.fsf@gmx.de> (raw)
In-Reply-To: <83ehhbn680.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 23 Jan 2013 19:45:35 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>  2) This gets worse with remote file names.  For these, the handlers
>     are always called first, and the result is never run through
>     dostounix_filename.  However, Tramp sometimes turns around and
>     calls the "real" handler on parts of the remote file name,
>     evidently expecting that "real" handler not to do any harm.  But
>     due to the above, it does do harm.  While it might be justified to
>     limit native file name support to file names encodable with the
>     current file-name-coding-system, it _cannot_ be justified for
>     remote file names.  An example of this is file-name-directory:
>
>      (defun tramp-handle-file-name-directory (file)
>        "Like `file-name-directory' but aware of Tramp files."
>        ;; Everything except the last filename thing is the directory.  We
>        ;; cannot apply `with-parsed-tramp-file-name', because this expands
>        ;; the remote file name parts.  This is a problem when we are in
>        ;; file name completion.
>        (let ((v (tramp-dissect-file-name file t)))
> 	 ;; Run the command on the localname portion only.
> 	 (tramp-make-tramp-file-name
> 	  (tramp-file-name-method v)
> 	  (tramp-file-name-user v)
> 	  (tramp-file-name-host v)
> 	  (tramp-run-real-handler
> 	   'file-name-directory (list (or (tramp-file-name-localname v) ""))))))
>
>     which on Windows means that, e.g.
>
>       (let ((file-name-coding-system 'cp1252))
> 	(file-name-directory "/eliz@fencepost.gnu.org:漢字/"))
>
>        => "/eliz@fencepost.gnu.org:  /"
>
>    And there are other similar handlers in Tramp (e.g., the
>    file-name-nondirectory handler) which do the same.  IOW, they seem
>    to _assume_ that the corresponding "real" handler never needs to
>    encode the file name.  A false assumption.

Tramp is not prepared to handle encoded file names. One of the first
actions on the remote side is to set the environment "LC_ALL=C". An
exception are Android devices, which require UTF-8.

I agree, Tramp shall check carefully what a file name encoding is. This
must be added to the code.

There might be a chance to switch to en_US.UTF-8 on the remote side. But
even here I would propose to start with the unibyte subset. "en_US",
because Tramp parses the output of commands, which must not be
localized.

Other encodings but UTF-8 will be hard to support. It is not only that
Tramp calls "native" file name primitives, there are also several
parsing routines for commands on the remote side, which have their
expectations on file name syntax and their encodings.

> TIA

Best regards, Michael.



  parent reply	other threads:[~2013-01-23 19:42 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23 17:45 Multibyte and unibyte file names Eli Zaretskii
2013-01-23 18:08 ` Paul Eggert
2013-01-23 19:04   ` Eli Zaretskii
2013-01-23 23:38     ` Paul Eggert
2013-01-23 19:42 ` Michael Albinus [this message]
2013-01-23 20:05   ` Eli Zaretskii
2013-01-23 20:58     ` Michael Albinus
2013-01-24 16:37       ` Eli Zaretskii
2013-01-23 21:09 ` Stefan Monnier
2013-01-24 17:02   ` Eli Zaretskii
2013-01-24 18:25     ` Stefan Monnier
2013-01-24 18:38       ` Eli Zaretskii
2013-01-25  0:06         ` Stefan Monnier
2013-01-25  7:37           ` Eli Zaretskii
2013-01-25 11:36             ` Stefan Monnier
2013-01-25 20:31               ` Eli Zaretskii
2013-01-25 22:28                 ` Stefan Monnier
2013-01-26 10:54                   ` Eli Zaretskii
2013-01-26 11:34                     ` Stefan Monnier
2013-01-26 13:16                       ` Eli Zaretskii
2013-01-26 22:11                         ` Stefan Monnier
2013-01-27  7:03                           ` Eli Zaretskii
2013-01-27  8:46                             ` Andreas Schwab
2013-01-27  9:40                               ` Eli Zaretskii
2013-01-28  1:55                             ` Stefan Monnier
2013-01-28 14:44                               ` Eli Zaretskii
2013-01-28 15:21                                 ` Stefan Monnier
2013-02-02 17:19                                   ` Eli Zaretskii
2013-01-26 13:20                       ` Stephen J. Turnbull
2013-01-26  3:04                 ` Stephen J. Turnbull
2013-01-26 11:27                   ` Eli Zaretskii
2013-01-26 13:03                     ` Stephen J. Turnbull
2013-01-26 13:36                       ` Eli Zaretskii
2013-01-26 16:26                         ` Paul Eggert
2013-01-26 18:30                           ` Stephen J. Turnbull
2013-01-26 17:10                         ` Stephen J. Turnbull
2013-01-26 17:33                           ` Eli Zaretskii
2013-01-26 18:06                             ` Paul Eggert
2013-01-26 18:20                               ` Eli Zaretskii
2013-01-26 18:56                             ` Stephen J. Turnbull
2013-01-26 21:40                               ` Stefan Monnier
2013-01-26 21:44                             ` Stefan Monnier
2013-01-27  6:14                               ` Eli Zaretskii
2013-01-26 16:05                   ` Richard Stallman
2013-01-26 17:57                     ` Stephen J. Turnbull
2013-01-26 22:16                     ` Stefan Monnier
2013-01-24 10:00 ` Michael Albinus
2013-01-24 16:40   ` Eli Zaretskii

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=87mwvz1y9s.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=kzhr@d1.dion.ne.jp \
    /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.