tkf / emacs-request

Request.el -- Easy HTTP request for Emacs Lisp
http://tkf.github.com/emacs-request/
GNU General Public License v3.0
629 stars 93 forks source link

CURL backend encoding problems #134

Closed truls closed 5 years ago

truls commented 5 years ago

Hi,

I just encountered a rather elusive bug which caused binary files (PDFs) to occasionally get corrupted due to an encoding issue.

The problem seems to be that request.el (at least when using the CURL backend) defaults to decoding downloaded data as UTF-8. To me, this seems counter intuitive as I would expect the library to return raw unmodified data and leave the decoding up to the user or, alternatively, decode according to the content-type header.

In the past, it seems that this was the case. Why was it changed? https://github.com/tkf/emacs-request/commit/258c6bf3729eff72aaeb169b4d06f050e8eea565

For now, I'm working around my issue by specifying :encoding 'no-conversion in my requests.

dickmao commented 5 years ago

85 is the most commented issue, and links to several others in other projects.

Unfortunately only one default can be chosen, and as the saying goes, "You can only please some of the people some of the time..."

truls commented 5 years ago

Having a default which corrupts binary files makes absolutely no sense. In any case, there needs to be a big fat warning in the docs about this.

dickmao commented 5 years ago

You got it.