Subject: End-of-line problems with text files inside zip files

From: "R. Diez" <[email-masked]>
Date: Tue, 26 Aug 2025 09:29:48 +0200

Hi all:

I am using Emacs 29, and I have built Emacs myself on Ubuntu 22.04. But I have had this issue with older Emacs and Ubuntu versions too.

I have attached a zip file with 3 text files:

test1.txt - with encoding utf-8-with-signature-dos
test2.xml - with encoding utf-8-dos
test3.xml - with encoding utf-8-dos too

If if unpack the zip file in the shell and open those files with Emacs, everything is fine.

However, if you open the zip file with Emacs, and then open those text files inside, there are end-of-line problems:

test1.txt shows encoding utf-8-with-signature-unix. That is, it loses the DOS CR LF line terminators.

test2.xml has a similar problem. The encoding is then shown as utf-8-unix.

test3.xml has the same problem, but each line shows a ^M marker at the end. The only difference between test2.xml and test3.xml is that the latter starts with this line:

<?xml version="1.0" encoding="UTF-8"?>

This problem is probably known, but I could not find a description or a workaround on the Internet. Or maybe I did not come up with the right search keywords.

Regards,
   rdiez