From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#48902: 28.0.50; Directory names containing apostrophes and backticks cause problems Date: Tue, 08 Jun 2021 17:02:25 +0300 Message-ID: <83zgw0e9ou.fsf@gnu.org> References: <51cb-60bf4900-1dd-2840bc80@23790836> <875yyoo9gy.fsf@gnus.org> <834ke8fs68.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33836"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48902@debbugs.gnu.org, larsi@gnus.org, salutis@me.com, naofumi@yasufuku.dev To: Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 08 16:03:39 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqcKQ-0008a2-FK for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Jun 2021 16:03:38 +0200 Original-Received: from localhost ([::1]:52182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqcKP-0007s0-EH for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Jun 2021 10:03:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqcJq-000765-Hq for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2021 10:03:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lqcJq-0005xp-AV for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2021 10:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lqcJq-0008Q9-83 for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2021 10:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Jun 2021 14:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48902 X-GNU-PR-Package: emacs Original-Received: via spool by 48902-submit@debbugs.gnu.org id=B48902.162316097932352 (code B ref 48902); Tue, 08 Jun 2021 14:03:02 +0000 Original-Received: (at 48902) by debbugs.gnu.org; 8 Jun 2021 14:02:59 +0000 Original-Received: from localhost ([127.0.0.1]:59399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqcJj-0008Pg-4u for submit@debbugs.gnu.org; Tue, 08 Jun 2021 10:02:59 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqcJg-0008PS-Gy for 48902@debbugs.gnu.org; Tue, 08 Jun 2021 10:02:53 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34250) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqcJY-0005jC-Sp; Tue, 08 Jun 2021 10:02:44 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4802 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqcJX-0008WJ-Hs; Tue, 08 Jun 2021 10:02:44 -0400 In-Reply-To: (message from Alan Third on Tue, 8 Jun 2021 14:00:17 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208241 Archived-At: > Date: Tue, 8 Jun 2021 14:00:17 +0100 > From: Alan Third > Cc: larsi@gnus.org, naofumi@yasufuku.dev, 48902@debbugs.gnu.org, > salutis@me.com > > > It looks like stringWithLispString encodes into UTF-16? But file > > names on macOS should be encoded in UTF-8, and in fact > > allocInitFromFile already does TRT when it calls ENCODE_FILE, just > > before stringWithLispString is called. So I think the patch is > > correct. > > > > (UTF-16 encoding on macOS is for ENCODE_SYSTEM, right?) > > I think you're right. But confusingly initByReferencingFile takes an > NSString which is a UTF-16 format string, so if I remove all the calls > to ENCODE_FILE, stringWithLispString works fine. > > I guess we just need to make a note that stringWithLispString cannot > handle UTF-8 encoded filenames, unless someone has a smarter solution. If you do need a UTF-16 encoded string, then instead of ENCODE_FILE you can call code_convert_string_norecord with Qutf_16. There's no need to invent or use a private UTF-16 encoder there, and you also get rid of an unnecessary extra UTF-8 encoding as a bonus.