httprepl.el icon indicating copy to clipboard operation
httprepl.el copied to clipboard

Handling of charsets

Open pidu opened this issue 11 years ago • 4 comments

Would be nice if charsets would work, otherwise cool mode.

pidu avatar Oct 28 '14 20:10 pidu

Can you give a specific example of what doesn't work? What are you expecting and what doesn't hold up to this expectation? Which charset are you having issues with? Which version of Emacs are you running?

gregsexton avatar Oct 29 '14 20:10 gregsexton

So, I'm running Emacs 24.4, and from the httprepl issue:

get www.google.se

I get headers specifying ISO-8859-1... httprepl 2014-10-31 14-19-09

but the body has some strange stuff in it: httprepl 2014-10-31 14-19-52

Now this particular case was for ISO-8859-1 but I recall seeing this even for charset UTF-8.

I noticed these problems on my first test of the httprepl so I just assumed charset conversions had not been considered. Now that I've investigated further it seems just buggy because it sometimes work.

pidu avatar Oct 31 '14 13:10 pidu

OK, I see the problem now. I'll look in to this and see what I can do. If you find an example url with a utf-8 response that doesn't work, that would be really useful too.

There is no charset/encdoing logic in httprepl, I get the same problem if I run curl www.google.se in eshell or using M-x shell-command.

gregsexton avatar Nov 01 '14 11:11 gregsexton

I've been looking in to this. I need to

  • Parse out the content type encoding declaration (can encoding be specified in any other way in http?)
  • Decode the output string using something like:
(defun httprepl-insert (&rest args)
  (dolist (string args)
    (when string
      (comint-output-filter (get-buffer-process (current-buffer)) (decode-coding-string string 'iso-8859-1)))))

gregsexton avatar Jul 04 '15 12:07 gregsexton