emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: url-retrieve-synchronously and coding


From: Lennart Borgman
Subject: Re: url-retrieve-synchronously and coding
Date: Mon, 24 Jan 2011 20:59:07 +0100

On Mon, Jan 24, 2011 at 6:29 PM, Lennart Borgman
<address@hidden> wrote:
> On Mon, Jan 24, 2011 at 4:11 PM, Julien Danjou <address@hidden> wrote:
>> On Mon, Jan 24 2011, Lennart Borgman wrote:
>>
>>> It seems natural in a case like this where Content-Type is text/xml to
>>> look for the specified charset in the xml content. I think
>>> `url-insert' should do this. Here is a suggestion for how to do it
>>> where I just have added a search for <?xml encoding=...>:
>>
>> Damn no, I don't think *url*-insert should parse XML, or you'll end up
>> parsing a lot of file type. This is not what url is about.
>
> url-insert already does character decoding, but only if the
> information is in the mime headers.
>
> Isn't it easier to understand and maintain if all decoding is done at
> the same place? Maybe url-insert is not the right place to do any
> decoding?
>
>
>> What you need is another layer on top of mm (or enhance mm) with
>> something like this:
>>
>> #+begin_src emacs-lisp
>> (defvar mm-decoder-helper-functions
>>  '(("text/xml" . 'mm-decoder-xml-helper)))
>
> Yes, that looks like a good structure. But where exactly should this
> be done? Where is multi-part messages char decoding handled?

It looks to me like url-insert-file-contents is a code place for
decoding. So I suggest the following:

1) Move the decoding from url-insert to url-insert-file-contents.
2) Replace the call to decode-coding-inserted-region in
url-insert-file-contents with something that also takes care of xml
encoding and similar things.

But I wonder what to use for 2. Something like Julien suggested seems
good to me. If no entry is find (or used) in
mm-decoder-helper-functions then probably
decode-coding-inserted-region should be called.

This of course means that the functions for decoding should be in
url-handlers.el (which Julien objected against).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]