curl-library
Re: curl_escape() space character bug?
Date: Thu, 20 Jun 2002 09:15:26 +0200 (MET DST)
On Wed, 19 Jun 2002, Combes, Chris M. wrote:
> I thought that a URL encoded string should convert the space character to
> %20 (hex).
>
> curl_escape() converts the space character to a "+".
The function is wrong, you are right.
> Also, curl_unescape() does not return the original string:
>
> original, operation=name=abcd efg&value=5
> curl_escape(), operation=name%3Dabcd+efg%26value%3D5
> curl_unescape(), operation=name=abcd+efg&value=5
>
> The original space was converted to a plus sign, but did not convert back
> to a space.
That's because the '+' was added wrongly. The decoding of '+' to a space in
the query part is probably also unnecessary/bad.
> RFC 1738, Uniform Resource Locators (URL), mentions using %20 in place of
> the space character.
>
> RFC 2316 is mentioned in escape.c, but this rfc is about Report of the IAB
> Security Architecture Workshop.
Right, RFC 2396 is what it meant to say.
-- Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/ ------------------------------------------------------- Bringing you mounds of caffeinated joy >>> http://thinkgeek.com/sf <<<Received on 2002-06-20