[Top][All Lists]

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

bug#8706: 24.0.50; [PATCH] Function to build a URL query-string

From: Ted Zlatanov
Subject: bug#8706: 24.0.50; [PATCH] Function to build a URL query-string
Date: Tue, 7 Jun 2011 13:58:17 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

On Tue, 7 Jun 2011 10:07:40 -0700 Ian Eure <address@hidden> wrote: 

IE> On May 25, 2011, at 1:31 PM, Ted Zlatanov wrote:

>> Single-element parameters, shown as just "key" instead of "key=val", are
>> a well-known URL query string convention.  They are not opaque.  I think
>> they should be explicitly supported.
IE> As I said, they _are_ supported. You just have to explicitly pass an empty 
string in the pair:

(url-build-query-string '(("a" "b") ("c" "") (d)))
=> "a=b&c=&d="

IE> I believe this is the correct behavior.

You're right, it's not incorrect, but it's not optimal.  The extra "="
can be safely omitted and it's preferrable to do so (for readability and
to save bytes).  Maybe that could be optional behavior.

Also we could add an option to make ";" the separator (though the
default should still be "&").

IE> It's also precisely what url-parse-query-string returns:

IE> (url-parse-query-string "a=b&c=") -> (("c" "") ("a" "b"))

It's actually broken for valid URLs: (url-parse-query-string "a=b&c")
=> (("a" "b"))

Plus it doesn't support the ";" separator.

Ugh.  Sorry to be a pain... but it's broken...

IE> Here's an updated patch which should correctly support everything
IE> url-parse-query-string produces. I also updated it to allow empty
IE> keys, as this was fairly easy with the code refactored to support
IE> (key val val val) syntax.

That all works great (I see it in the first example above).

Let me know how much of the above you want to do; I can implement all
the things I asked for if you're too busy.  I appreciate your help.


reply via email to

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