Skip to main content


Dear #LazyWeb:

Is there a tool that I can use in a #bash script to sanitize a string for inclusion into a URL parameter (e.g.: "foo bar" becomes "foo+bar" or "foo%20bar")?

#AskFedi

reshared this

echo 'foo bar’ | jq -srR ‘@uri’; if you use curl you could also consider curl --data-urlencode

maybe `jq`?

https://stackoverflow.com/a/34407620/8607180

perl -MURI::Encode=uri_encode -E'say uri_encode shift' 'foo bar'
This entry was edited (6 months ago)
I ended up just doing it in Python.

This website uses cookies. If you continue browsing this website, you agree to the usage of cookies.

⇧