unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30664: 25.2; eww-download corrupts PDF files (and probably other binary files too)
@ 2018-03-01 15:58 omar.antolin
  2018-03-01 17:10 ` Andreas Schwab
  2018-03-01 19:17 ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: omar.antolin @ 2018-03-01 15:58 UTC (permalink / raw)
  To: 30664


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 
might be best to modify the function `eww-download-callback` to
save the downloaded file with no-conversion either always or in certain
cases. Maybe the HTTP response can be inspected and if the type is not
text/something to use no-conversion.



In GNU Emacs 25.2.1 (i686-w64-mingw32)
 of 2017-04-24 built on LAPHROAIG
Windowing system distributor 'Microsoft Corp.', version 10.0.16299
Configured using:
 'configure --host=i686-w64-mingw32 --without-dbus
 --without-compress-install 'CFLAGS=-static -O2 -g3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1252

Major mode: Lisp Interaction

Minor modes in effect:
  recentf-mode: t
  rainbow-delimiters-mode: t
  which-key-mode: t
  smartparens-global-mode: t
  smartparens-mode: t
  ivy-mode: t
  global-gobble-whitespace-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Loading em-prompt...done
Loading em-script...done
Loading em-term...done
Loading em-unix...done
History item: 128
No matches
History item: 128
Mark saved where search started
Delete julia-0.6.1-win32.exe (y or n) y
Deleting...done
Quit

Load-path shadows:
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ox hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ox
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ox-texinfo hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ox-texinfo
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ox-publish hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ox-publish
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ox-org hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ox-org
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ox-odt hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ox-odt
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ox-md hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ox-md
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ox-man hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ox-man
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ox-latex hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ox-latex
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ox-icalendar hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ox-icalendar
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ox-html hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ox-html
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ox-beamer hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ox-beamer
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ox-ascii hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ox-ascii
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-w3m hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-w3m
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-version hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-version
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-timer hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-timer
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-table hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-table
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-src hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-src
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-rmail hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-rmail
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-protocol hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-protocol
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-plot hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-plot
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-pcomplete hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-pcomplete
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-mouse hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-mouse
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-mobile hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-mobile
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-mhe hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-mhe
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-macs hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-macs
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-macro hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-macro
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-loaddefs hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-loaddefs
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-list hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-list
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-irc hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-irc
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-install hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-install
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-inlinetask hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-inlinetask
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-info hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-info
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-indent hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-indent
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-id hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-id
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-habit hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-habit
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-gnus hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-gnus
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-footnote hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-footnote
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-feed hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-feed
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-faces hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-faces
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-eshell hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-eshell
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-entities hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-entities
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-element hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-element
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-docview hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-docview
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-datetree hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-datetree
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-ctags hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-ctags
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-crypt hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-crypt
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-compat hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-compat
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-colview hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-colview
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-clock hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-clock
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-capture hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-capture
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-bibtex hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-bibtex
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-bbdb hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-bbdb
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-attach hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-attach
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-archive hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-archive
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/org-agenda hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/org-agenda
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-tangle hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-tangle
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-table hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-table
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-sqlite hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-sqlite
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-sql hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-sql
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-shen hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-shen
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-screen hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-screen
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-scheme hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-scheme
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-sass hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-sass
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-ruby hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-ruby
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-ref hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-ref
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-R hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-R
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-python hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-python
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-plantuml hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-plantuml
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-picolisp hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-picolisp
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-perl hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-perl
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-org hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-org
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-octave hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-octave
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-ocaml hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-ocaml
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-mscgen hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-mscgen
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-maxima hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-maxima
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-matlab hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-matlab
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-makefile hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-makefile
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-lob hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-lob
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-lisp hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-lisp
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-lilypond hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-lilypond
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-ledger hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-ledger
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-latex hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-latex
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-keys hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-keys
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-js hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-js
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-java hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-java
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-io hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-io
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-haskell hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-haskell
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-gnuplot hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-gnuplot
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-fortran hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-fortran
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-exp hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-exp
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-eval hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-eval
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-emacs-lisp hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-emacs-lisp
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-dot hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-dot
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-ditaa hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-ditaa
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-css hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-css
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-core hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-core
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-comint hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-comint
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-clojure hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-clojure
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-calc hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-calc
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-C hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-C
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-awk hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-awk
c:/Users/oanto/.emacs.d/elpa/org-plus-contrib-20180226/ob-asymptote hides c:/Users/oanto/Emacs-25.2/share/emacs/25.2/lisp/org/ob-asymptote

Features:
(shadow sort bbdb-message mail-extr emacsbug message idna rfc822 mml
mml-sec epg mm-decode mm-bodies mm-encode gmm-utils mailheader sendmail
pcmpl-unix em-unix em-term term ehelp em-script em-prompt em-ls em-hist
em-pred em-glob em-dirs em-cmpl em-basic em-banner em-alias pcomplete
esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg esh-groups
eshell esh-module esh-mode dired-aux wdired macros mc-prompt-once
multiple-cursors mc-hide-unmatched-lines-mode mc-separate-operations
rectangular-region-mode mc-mark-pop mc-mark-more mc-cycle-cursors
mc-edit-lines multiple-cursors-core rect dabbrev misc-text executable
two-column iso-transl ace-window eieio-opt speedbar sb-image ezimage
dframe find-func doc-view jka-compr image-mode parse-time recentf
tree-widget bookmark pp network-stream nsm starttls url-http tls gnutls
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums url-gw url-cache url-auth
eww mm-url bbdb-mua bbdb-com crm mailabbrev bbdb bbdb-site timezone gnus
gnus-ems nnheader mail-utils url-queue url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap shr dom subr-x browse-url format-spec colir color smex ido
counsel dired compile comint ansi-color esh-util etags xref project
swiper rainbow-delimiters which-key smartparens-config smartparens
advice dash cus-edit cus-start cus-load wid-edit ivy-hydra ivy delsel
ivy-overlay ffap thingatpt url-parse auth-source eieio eieio-core
gnus-util mm-util help-fns mail-prsvr password-cache url-vars ace-link
avy hydra ring lv gobble-whitespace edmacro kmacro diminish cl-macs
cl-seq use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core finder-inf tex-site slime-autoloads info package
epg-config seq byte-opt gv bytecomp byte-compile cl-extra help-mode
easymenu cconv cl-loaddefs pcase cl-lib time-date mule-util tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
dos-w32 ls-lisp disp-table w32-win w32-vars term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame
cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote w32notify w32 multi-tty
make-network-process emacs)

Memory information:
((conses 8 346633 45907)
 (symbols 32 39136 0)
 (miscs 32 154 602)
 (strings 16 91623 67578)
 (string-bytes 1 2621517)
 (vectors 8 42157)
 (vector-slots 4 1449017 44142)
 (floats 8 541 810)
 (intervals 28 531 1239)
 (buffers 520 48))





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30664: 25.2; eww-download corrupts PDF files (and probably other binary files too)
  2018-03-01 15:58 bug#30664: 25.2; eww-download corrupts PDF files (and probably other binary files too) omar.antolin
@ 2018-03-01 17:10 ` Andreas Schwab
  2018-03-01 19:18   ` Eli Zaretskii
  2018-03-01 19:17 ` Eli Zaretskii
  1 sibling, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2018-03-01 17:10 UTC (permalink / raw)
  To: omar.antolin; +Cc: 30664

On Mär 01 2018, omar.antolin@gmail.com 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, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30664: 25.2; eww-download corrupts PDF files (and probably other binary files too)
  2018-03-01 15:58 bug#30664: 25.2; eww-download corrupts PDF files (and probably other binary files too) omar.antolin
  2018-03-01 17:10 ` Andreas Schwab
@ 2018-03-01 19:17 ` Eli Zaretskii
       [not found]   ` <CAL03oyLjOiFtdiY+_OCHHSSzn+7iEepZAHq08fOvMiN2HhLpqQ@mail.gmail.com>
  1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2018-03-01 19:17 UTC (permalink / raw)
  To: omar.antolin; +Cc: 30664

> From: omar.antolin@gmail.com
> Date: Thu, 01 Mar 2018 09:58:30 -0600
> 
> 
> 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.

Does the patch below fix the problem?

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index caac96a..66b1767 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1532,7 +1532,8 @@ eww-download-callback
                   eww-download-directory)))
       (goto-char (point-min))
       (re-search-forward "\r?\n\r?\n")
-      (write-region (point) (point-max) file)
+      (let ((coding-system-for-write 'no-conversion))
+        (write-region (point) (point-max) file))
       (message "Saved %s" file))))
 
 (defun eww-decode-url-file-name (string)





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#30664: 25.2; eww-download corrupts PDF files (and probably other binary files too)
  2018-03-01 17:10 ` Andreas Schwab
@ 2018-03-01 19:18   ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2018-03-01 19:18 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 30664, omar.antolin

> From: Andreas Schwab <schwab@suse.de>
> Date: Thu, 01 Mar 2018 18:10:34 +0100
> Cc: 30664@debbugs.gnu.org
> 
> I think it's only a problem because PDF files look like text files.
> Other binary files are immediately recognized as binary.

You are right, but I think a download function should produce a file
that is identical to its original, even if it's a text file.  No
coding conversions or EOL conversions should take place.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30664: 25.2; eww-download corrupts PDF files (and probably other binary files too)
       [not found]   ` <CAL03oyLjOiFtdiY+_OCHHSSzn+7iEepZAHq08fOvMiN2HhLpqQ@mail.gmail.com>
@ 2018-03-02  8:46     ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2018-03-02  8:46 UTC (permalink / raw)
  To: Omar Antolín Camarena; +Cc: 30664-done

> From: Omar Antolín Camarena <omar.antolin@gmail.com>
> Date: Thu, 1 Mar 2018 15:24:27 -0600
> 
> I tested it and yes, that patch does fix the problem for me.

Thanks, I installed that on the emacs-26 branch, and I'm closing the
bug report.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-02  8:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-01 15:58 bug#30664: 25.2; eww-download corrupts PDF files (and probably other binary files too) omar.antolin
2018-03-01 17:10 ` Andreas Schwab
2018-03-01 19:18   ` Eli Zaretskii
2018-03-01 19:17 ` Eli Zaretskii
     [not found]   ` <CAL03oyLjOiFtdiY+_OCHHSSzn+7iEepZAHq08fOvMiN2HhLpqQ@mail.gmail.com>
2018-03-02  8:46     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).