From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <83fvtahx6g.fsf@gnu.org> References: <87a9jj7eqj.fsf@gmail.com> <83y573ihzw.fsf@gnu.org> <87a9jjv44z.fsf@gmail.com> <83vc27ib2r.fsf@gnu.org> <87r4cuwrob.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Trace: ger.gmane.org 1379000094 2663 80.91.229.3 (12 Sep 2013 15:34:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Sep 2013 15:34:54 +0000 (UTC) Cc: 15337@debbugs.gnu.org To: Thierry Volpiatto Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 12 17:34:56 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VK8uS-0005Jx-Ah for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Sep 2013 17:34:20 +0200 Original-Received: from localhost ([::1]:42499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK8uR-0006Xr-Vd for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Sep 2013 11:34:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK8uH-0006Te-OY for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2013 11:34:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VK8uA-00072V-Dp for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2013 11:34:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50816) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK8uA-00072R-AC for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2013 11:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VK8u9-0001cb-OC for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2013 11:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Sep 2013 15:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15337 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 15337-submit@debbugs.gnu.org id=B15337.13790000316216 (code B ref 15337); Thu, 12 Sep 2013 15:34:01 +0000 Original-Received: (at 15337) by debbugs.gnu.org; 12 Sep 2013 15:33:51 +0000 Original-Received: from localhost ([127.0.0.1]:59109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VK8ty-0001cB-AS for submit@debbugs.gnu.org; Thu, 12 Sep 2013 11:33:50 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:45718) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VK8tv-0001bw-5r for 15337@debbugs.gnu.org; Thu, 12 Sep 2013 11:33:48 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MT000C00R7BHH00@a-mtaout20.012.net.il> for 15337@debbugs.gnu.org; Thu, 12 Sep 2013 18:33:41 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MT000CFIR84HG00@a-mtaout20.012.net.il>; Thu, 12 Sep 2013 18:33:41 +0300 (IDT) In-reply-to: <87r4cuwrob.fsf@gmail.com> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:78286 Archived-At: > From: Thierry Volpiatto > 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))