httprepl.el
httprepl.el copied to clipboard
Handling of charsets
Would be nice if charsets would work, otherwise cool mode.
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?
So, I'm running Emacs 24.4, and from the httprepl issue:
get www.google.se
I get headers specifying ISO-8859-1...

but the body has some strange stuff in it:

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.
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.
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)))))