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

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

bug#15337: 24.3.50; [PATCH] cd to directory name with french accent fail


From: Eli Zaretskii
Subject: bug#15337: 24.3.50; [PATCH] cd to directory name with french accent fail from term/ansi-term
Date: Thu, 12 Sep 2013 18:33:27 +0300

> From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
> Date: Thu, 12 Sep 2013 07:11:00 +0200
> 
> > If you cannot figure out where does the unibyte string come from,
> > please provide a test case starting from "emacs -Q".  Thanks.
> 
> So from emacs -Q
> 
> (I repeat my initial message)

Sorry, I didn't realize from your original message that M-x ansi-term
is all that is needed after "emacs -Q".

> M-x ansi-term
> cd ~/Téléchargements/
> 
> Debugger entered--Lisp error: (error "No such directory found via CDPATH 
> environment variable")
>   signal(error ("No such directory found via CDPATH environment variable"))
>   error("No such directory found via CDPATH environment variable")
>   cd("/home/thierry/T\303\251l\303\251chargements")

I think I see the problem.  term.el disables decoding of the shell
output, see term-exec-1.  So the text it gets from the shell is
unibyte, un-decoded text.  Therefore, whenever term.el calls other
functions, let alone functions that can be defined by the user, it
must decode the strings it passes to those functions.  And in this
case, it doesn't:

                         ((and (eq char ?\032)
                               (not handled-ansi-message))
                          (let ((end (string-match "\r?$" str i)))
                            (if end
                                (funcall term-command-hook
                                         (prog1 (substring str (1+ i) end)
                                           (setq i (match-end 0))))

Here 'str' is a unibyte string, while term-command-hook expects a
normal, multibyte string as its argument.

So please see if decoding the result of prog1 with
decode-coding-string, like you suggested to do in 'cd', but before
passing it to funcall, fixes the problem.  Something like this:

     (funcall term-command-hook
              (decode-coding-string
                (prog1 (substring str (1+ i) end)
                   (setq i (match-end 0)))
                locale-coding-system))





reply via email to

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