bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34704: 26.1; Wrong line endings detected for XML files


From: Eli Zaretskii
Subject: bug#34704: 26.1; Wrong line endings detected for XML files
Date: Fri, 01 Mar 2019 22:40:40 +0200

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]