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#21780: 25.0.50; Saving *Help* results in bad encoding because of curly quotes Date: Thu, 29 Oct 2015 20:18:29 +0200 Message-ID: <83lhal1qtm.fsf@gnu.org> References: <536fdfb7-20dd-4d23-886c-8e842b6844fd@default> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1446142767 2619 80.91.229.3 (29 Oct 2015 18:19:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Oct 2015 18:19:27 +0000 (UTC) Cc: 21780@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 29 19:19:16 2015 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 1ZrrnA-00007H-11 for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Oct 2015 19:19:16 +0100 Original-Received: from localhost ([::1]:45802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrrn9-0004Eq-Nm for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Oct 2015 14:19:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrrmz-00046T-S1 for bug-gnu-emacs@gnu.org; Thu, 29 Oct 2015 14:19:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zrrmw-0004Y9-G2 for bug-gnu-emacs@gnu.org; Thu, 29 Oct 2015 14:19:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrrmw-0004Y2-Bq for bug-gnu-emacs@gnu.org; Thu, 29 Oct 2015 14:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Zrrmw-0005v8-1E for bug-gnu-emacs@gnu.org; Thu, 29 Oct 2015 14:19: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: Thu, 29 Oct 2015 18:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21780 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21780-submit@debbugs.gnu.org id=B21780.144614273622747 (code B ref 21780); Thu, 29 Oct 2015 18:19:01 +0000 Original-Received: (at 21780) by debbugs.gnu.org; 29 Oct 2015 18:18:56 +0000 Original-Received: from localhost ([127.0.0.1]:44537 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zrrmq-0005up-7G for submit@debbugs.gnu.org; Thu, 29 Oct 2015 14:18:56 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:53151) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZrrmW-0005uH-0r for 21780@debbugs.gnu.org; Thu, 29 Oct 2015 14:18:55 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0NWZ00I00UTQYH00@a-mtaout23.012.net.il> for 21780@debbugs.gnu.org; Thu, 29 Oct 2015 20:18:27 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NWZ00IIMUUQXD20@a-mtaout23.012.net.il>; Thu, 29 Oct 2015 20:18:27 +0200 (IST) In-reply-to: <536fdfb7-20dd-4d23-886c-8e842b6844fd@default> 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: 208.118.235.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:108153 Archived-At: > Date: Thu, 29 Oct 2015 10:58:24 -0700 (PDT) > From: Drew Adams > Cc: 21780-done@debbugs.gnu.org > > > > emacs -Q > > > M-x load-library isearch.el > > > C-h f isearch-forward > > > In buffer *Help*: C-x C-w foo.txt > > > > > > You get a coding-system warning. I tried saving it as utf-8 and as raw > > > text. > > > > > > In both cases, when I open that file in a new Emacs session, I see octal > > > escapes where there were curly quotes. > > > > Thanks, I fixed the first part of this: Emacs should no longer ask > > annoying questions when you save help buffers with curved quotes. > > > > The second part, which happens when visiting the saved file, is not a > > bug: you need to specify the encoding of files when visiting them in > > locales whose default encoding is different. (Actually, I expect this > > to work automatically for you, at least in "emacs -Q", but that > > doesn't happen in every locale.) > > I guess I should interpret this as meaning that the bug is fixed (?). Yes, I think so. > But I don't understand the second part. What do I need to change, as > a user, to get this to work as I would expect? It might work as you expect already. You can try this: . After "C-h f some-function RET", switch to the *Help* buffer and type "C-x RET f utf-8 RET", then save the buffer as in your recipe. . Now visit the file where you saved the *Help* buffer: if the curved quotes display correctly, then "it works for you". . If the curved quotes look like raw bytes or, worse, pairs of non-ASCII characters, you need to visit such file like this: C-x RET c utf-8 RET C-x C-f FILE-NAME RET > In Emacs, before saving, the buffer looks fine. It looks fine, but the encoding mnemonic on the mode line is not "U" (which stands for UTF-8), right? That is why Emacs asks you for encoding: it cannot save these characters using your locale's default encoding (which is what the *Help* buffer uses by default). > When visiting the resulting file it does not look right - it is > unreadable. There are 3 octal escapes for each opening curly quote > and 3 of them for each closing curly quote. That can amount to > quite a lot of noise. Yes, because you probably told Emacs to use raw-text or somesuch, when it asked. > Do I need to save the buffer using some other encoding? If so, which? Yes, you could tell it to use UTF-8 when it asked. (After my change, Emacs will do that automatically, no questions asked, when saving *Help* buffers with curved quotes.) > Emacs proposed two encodings (one of which was raw text, which I tried; > and I tried also utf-8, which I would have thought would show curly > quotes OK. UTF-8 should have worked. I wouldn't expect you to see octal escapes after saving in UTF-8. > I would think that Emacs would DTRT when opening the file, based on > the encoding used to save it. It cannot always do that. To make sure it always does, there should be a 'coding' cookie in the file or a file-local variable to the same effect. But you will have to add it manually; I don't think it's OK for Emacs to insert such additions on its own, because Emacs has no idea how the file will be used. > Should users really need to do something special each time they > visit the file? They've never had to do this before, for basic, > common *Help* output. If you customize text-quoting-style to use ASCII characters for quoting, Emacs will still behave as it did before: the file you produce will be pure ASCII, so no decoding is necessary. > If readers have to jump through hoops (e.g. changing "locales"), > and there is no good fix for this regression in behavior, then I'd > suggest that maybe `describe-*' commands should not use curly quotes. Saving a *Help* buffer is not a frequent operation, and most users nowadays live in UTF-8 locales anyway. And even in some non-UTF-8 locales Emacs will succeed in displaying the file correctly when visiting it, even without the need to type "C-x RET c". So I think this is not a catastrophe. > [Or could this perhaps be a font problem? Might the default font > (e.g. on MS Windows) just need to be changed?] No, it's not a font problem: Emacs did display those characters before you saved the buffer, right?