Android Question StringUtils UrlEncode Spaces

rbw152

Member
Licensed User
Longtime User
Hi all,

Just quickly wondering if there's a way to make StringUtils UrlEncode make spaces into '%20' instead of '+'.
I'm trying to download a pdf file using its URL and it won't find the file with the '+' but if I replace with a '%20' in the address bar, all goes well.

Thanks in advance!
 

rbw152

Member
Licensed User
Longtime User
+ is the correct escape value for spaces in the query parameters.

You can replace the + with %20:
B4X:
encodedUrl = encodedUrl.Replace("+", "%20")

Well that seems to work, thanks. Just wondering why it won't work with + but does with %20. If + is the correct value, why do I need to replace the + every time?
 
Upvote 0
Top