Problem with URL encoding

Hey I have an issue with my parameters that I am attaching to a URL. For spaces in the parameter addEscapeChars changes them to ‘+’ but I need ‘%20’, what is the best way to change this? Also, I’m fairly new to C++ but I do know that messing around in any of the Juce classes is a very bad idea so if there is a workaround or if someone knows what needs to be changed in the URL class I would appreciate any input.


Surely ‘+’ is the standard way to encode a space…? Why do you need it as %20 instead?

This looks helpful:

Interesting. Well, my function is only intended for use in the context of a URL string, so it’s not incorrect… But since it would still work if it used %20 instead, perhaps I should change it, to make it useful in other contexts too?

If I understand the StackOverflow correctly + can only be used in the part after ? (because that’s the application/x-www-form-encoded part). The url path/?key=some value

would using your function on the whole url become ‘’ which is wrong. It should be


The company I work for uses their own server side scripting language and after researching some of the other calls I was making and looking at the URL created by Juce I noticed that it actaully mangles the params (by making them safe :smiley: ) so I have a new question.

Would it be possible to add something that allows you to strictly specify your own parameters with out any encoding from Juce URL class? I know it seems ridiculous to do it yourself when Juce does it for you, but it is something that has seriously ground me to a halt.

(BTW I changed the code to always use %20)

Re: mangling the params yourself… If your params are pre-mangled, then can’t you just concatenate them and pass them into the URL constructor that takes the whole thing as a string?

thanks for making the change, and yes i can!! no idea how i missed that :oops: