Subject: bug#30664: 25.2; eww-download corrupts PDF files (and probably other binary files too)

From: Andreas Schwab <[email-masked]>
Date: Thu, 01 Mar 2018 18:10:34 +0100

On Mär 01 2018, [email-masked] wrote:

> I tried using eww-download (bound to `d` in eww buffers) to download a
> PDF file. This produced, as expected a file in my downloads directory,
> but I could not open it in my PDF reader. I immediately suspected that
> Emacs had done some unwanted coding system translation on the PDF file.
>
> The variable `last-coding-system-used` was set to `raw-text-dos` (I'm
> using Emacs 25.2 on Windows 10), and the `dos` part sounded suspicious
> to me. Adding the item `("\\.pdf\\'" no-conversion . no-conversion)` to
> the variable `file-coding-system-alist` and redownloading the file fixed
> the problem and produced a valid PDF file.
>
> I'm not sure adding that entry to the default value of
> `file-coding-system-alist` is the right way to solve this problem
> though, because where does it stop? Would we add all known binary file
> types to the list with `no-conversion` specifications?

I think it's only a problem because PDF files look like text files.
Other binary files are immediately recognized as binary.

Andreas.

-- 
Andreas Schwab, SUSE Labs, [email-masked]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."