Skip to content

Conversation

johnboiles
Copy link
Collaborator

It's valid to encode spaces in URLs as '+' characters. According to w3 recommendations, "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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant