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

in reply to Jonathan Lamothe

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

maybe `jq`?

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

in reply to Jonathan Lamothe

perl -MURI::Encode=uri_encode -E'say uri_encode shift' 'foo bar'
This entry was edited (8 months ago)

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