[hunchentoot-devel] Probably a bug in url-encode/url-decode

Tab Atkins Jr. jackalmage at gmail.com
Fri Mar 19 03:04:53 UTC 2010


On Thu, Mar 18, 2010 at 4:45 PM, Andrey Moskvitin <archimag at gmail.com> wrote:
> Hi,
> I encountered the following problem:
> CL-USER> (hunchentoot:url-decode "+")
> " "
> CL-USER> (hunchentoot:url-encode "+")
> "%2B"
> But in JavaScript:
>>>> encodeURI("+")
> "+"
>>>> decodeURI("+")
> "+"
> This is a bug?
> Andrey

No, it just depends on which RFC you follow that describes URL
escaping.  For example, PHP has two different url-escaping functions
to handle the two RFCs - urlencode (like hunchentoot's url-encode),
and rawurlencode (like javascript's encodeURI).

That said, the behavior of javascript's encode functions are generally
more common.

~TJ




More information about the Tbnl-devel mailing list