gabriel/gh-kit — pull request #5 by johnboiles (2013-02-01 01:32:49+00:00)
Title: Handle spaces that are encoded as '+' in gh_decode

It's valid to encode spaces in URLs as '+' characters. According to [w3 recommendations](http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1), "Space characters are replaced by `+', and then reserved characters are escaped..."; jQuery's built in .param method does this:

{{{
> $.param({'test': 'oh hey hello'})
"test=oh+hey+hello"
}}}

Since CFURLCreateStringByReplacingPercentEscapes does not handle spaces encoded as '+', and I was unable to find a CoreFoundation that handled both percent escaping and spaces, the quick fix is to manually replace '+' characters with spaces. Any intentional '+' characters should already be encoded as %2B.

See also:
http://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20