all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Akkana Peck <akkana@shallowsky.com>
Cc: 34704@debbugs.gnu.org
Subject: bug#34704: 26.1; Wrong line endings detected for XML files
Date: Fri, 01 Mar 2019 22:40:40 +0200	[thread overview]
Message-ID: <83tvgmgwfr.fsf@gnu.org> (raw)
In-Reply-To: <20190301172329.GA1295@shallowsky.com> (message from Akkana Peck on Fri, 1 Mar 2019 10:23:30 -0700)

> Date: Fri, 1 Mar 2019 10:23:30 -0700
> From: Akkana Peck <akkana@shallowsky.com>
> 
> 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.





  reply	other threads:[~2019-03-01 20:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 17:23 bug#34704: 26.1; Wrong line endings detected for XML files Akkana Peck
2019-03-01 20:40 ` Eli Zaretskii [this message]
2019-03-02  2:27   ` Glenn Morris
2019-03-02  6:53     ` Eli Zaretskii
2019-03-02  8:47       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83tvgmgwfr.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=34704@debbugs.gnu.org \
    --cc=akkana@shallowsky.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.