From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#34704: 26.1; Wrong line endings detected for XML files Date: Fri, 01 Mar 2019 22:40:40 +0200 Message-ID: <83tvgmgwfr.fsf@gnu.org> References: <20190301172329.GA1295@shallowsky.com> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="124769"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 34704@debbugs.gnu.org To: Akkana Peck Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 01 21:56:30 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gzpCn-000WK0-Av for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Mar 2019 21:56:29 +0100 Original-Received: from localhost ([127.0.0.1]:43973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzpCm-00073l-CL for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Mar 2019 15:56:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzpCd-0006yC-Js for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2019 15:56:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzoyr-0005EE-MB for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2019 15:42:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43282) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzoyn-0005Ad-QX for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2019 15:42:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gzoyn-0007AM-Mf for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2019 15:42:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Mar 2019 20:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34704 X-GNU-PR-Package: emacs Original-Received: via spool by 34704-submit@debbugs.gnu.org id=B34704.155147287627492 (code B ref 34704); Fri, 01 Mar 2019 20:42:01 +0000 Original-Received: (at 34704) by debbugs.gnu.org; 1 Mar 2019 20:41:16 +0000 Original-Received: from localhost ([127.0.0.1]:56826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzoy3-00079M-TE for submit@debbugs.gnu.org; Fri, 01 Mar 2019 15:41:16 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzoxz-000797-EE for 34704@debbugs.gnu.org; Fri, 01 Mar 2019 15:41:14 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzoxh-000477-Jx; Fri, 01 Mar 2019 15:40:56 -0500 Original-Received: from [176.228.60.248] (port=1172 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gzoxh-0001nF-7B; Fri, 01 Mar 2019 15:40:53 -0500 In-reply-to: <20190301172329.GA1295@shallowsky.com> (message from Akkana Peck on Fri, 1 Mar 2019 10:23:30 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:155936 Archived-At: > Date: Fri, 1 Mar 2019 10:23:30 -0700 > From: Akkana Peck > > I often use emacs to edit GPX files produced by OsmAnd. > Emacs displays these files with ^M at the end, failing to detect > the proper newlines. od shows the file as having \r\n (^J^M) > at the end of every line. > > I initially thought this was because the final line of the file > lacks any newline characters, but if I edit the file and write it, > emacs adds a final ^J^M, and if I then try to read that file back > into emacs it still fails to detect the proper line endings, and > shows the ^M on every line. > > The problem is related to the file containing XML: > if I edit the file and change all the < > to ( ) then open the file, > it opens in Fundamental mode and emacs uses DOS encoding and doesn't > show the ^M characters. But if I open the file normally (it uses nXML > mode) then switch to Fundamental, that doesn't fix the erroneous > newline detection. Of course I can fix it manually, but I'd like > to find a way to get emacs to open the file properly without my > needing to run extra commands. An example file that causes this is needed to investigate the problem. There could be several different factors which cause this result, and it is impossible to know which one is responsible for your case. > | I think auto-coding-functions is a problem. > | sgml-xml-auto-coding-function specifically. > | mule.el: (memq detected '(utf-8 'utf-8-with-signature 'utf-8-hfs undecided)) > | That looks a bit funny to me. > | Ugh, no, it's both sgml-* functions in auto-coding-functions? > | I must have screwed something up, sgml-html-meta-auto-coding-function returns nil for me. > | But sgml-xml-auto-coding-function returns utf-8-unix. > | I don't know enough about how Emacs chooses character sets to speculate at how this should be fixed, but I *think* that function should probably return utf-8 not utf-8-unix. I'm afraid that doesn't clarify the issue. > I'm attaching a small test file that shows the problem. Your test file doesn't show a problem for me, neither with Emacs 26.1 nor with the current pretest of Emacs 26.2. I see an XML file with Unix EOL format, and no ^M characters. Maybe your mailer somehow "fixed" the file? Can you send it in a compressed archive? Please also test this in "emacs -Q", it could be that something in your customizations causes this.