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#21574: po-mode mishandles ASCII files Date: Mon, 28 Sep 2015 13:18:49 +0300 Message-ID: <838u7qetiu.fsf@gnu.org> References: <56084B12.90307@cs.ucla.edu> 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 1443453200 14147 80.91.229.3 (28 Sep 2015 15:13:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 28 Sep 2015 15:13:20 +0000 (UTC) Cc: 21574@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 28 17:13:08 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 1Zga72-0004tx-7x for geb-bug-gnu-emacs@m.gmane.org; Mon, 28 Sep 2015 17:13:08 +0200 Original-Received: from localhost ([::1]:37759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zga71-0000zD-Mx for geb-bug-gnu-emacs@m.gmane.org; Mon, 28 Sep 2015 11:13:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgVWT-0003yB-Fe for bug-gnu-emacs@gnu.org; Mon, 28 Sep 2015 06:19:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgVWQ-0003v3-7n for bug-gnu-emacs@gnu.org; Mon, 28 Sep 2015 06:19:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgVWQ-0003ut-4W for bug-gnu-emacs@gnu.org; Mon, 28 Sep 2015 06:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZgVWP-0006Gf-JE for bug-gnu-emacs@gnu.org; Mon, 28 Sep 2015 06:19: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: Mon, 28 Sep 2015 10:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21574 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21574-submit@debbugs.gnu.org id=B21574.144343552424054 (code B ref 21574); Mon, 28 Sep 2015 10:19:01 +0000 Original-Received: (at 21574) by debbugs.gnu.org; 28 Sep 2015 10:18:44 +0000 Original-Received: from localhost ([127.0.0.1]:46237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZgVW7-0006Fr-Eo for submit@debbugs.gnu.org; Mon, 28 Sep 2015 06:18:43 -0400 Original-Received: from mtaout29.012.net.il ([80.179.55.185]:41846) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZgVW4-0006Fe-AL for 21574@debbugs.gnu.org; Mon, 28 Sep 2015 06:18:41 -0400 Original-Received: from conversion-daemon.mtaout29.012.net.il by mtaout29.012.net.il (HyperSendmail v2007.08) id <0NVD00D00TS42L00@mtaout29.012.net.il> for 21574@debbugs.gnu.org; Mon, 28 Sep 2015 13:19:27 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by mtaout29.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NVD00HUPU0ETDD0@mtaout29.012.net.il>; Mon, 28 Sep 2015 13:19:27 +0300 (IDT) In-reply-to: <56084B12.90307@cs.ucla.edu> 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:106996 Archived-At: > From: Paul Eggert > Date: Sun, 27 Sep 2015 13:01:22 -0700 > > Emacs's po-mode mishandles .po files that specify charset=us-ascii. To > reproduce the problem on Fedora, run 'LC_ALL=cs_CZ.iso88592 emacs -Q fr.po' with > fr.po being the attached file (taken from Texinfo 6.0), and type '# C-x 8 RET > 161 RET RET C-x C-s'. The file will be saved with the line '#ลก' prepended, in > Latin-2 encoding, even though the file declares its encoding to be > charset=us-ascii. I think what you see is a side effect of a feature: when a character is added that can be safely encoded by the default value of buffer-file-coding-system, Emacs silently saves the file in that encoding. This feature was added in response to user requests not to bother them with annoying requests to select an encoding when all they did was add some non-ASCII text native to their locale to a file that was previously ASCII-only. What we need in this particular case, I think, is some code in po.el that would function similarly to what we already do when the file has a coding cookie, and the user adds characters that cannot be saved with the encoding stated by the cookie. Btw, do we have a similar problem in other files that have entries in file-coding-system-alist, like XML files or LaTeX files?