lhunath 1330793105 learn Prepare literal data for injection into a URL: urlquote() { while IFS= read -rd '' -n1 c; do printf %%%02x "'$c"; done; }; Eg. curl -s "http://host/?name=$(urlquote "$name")" lhunath 1340009903 forget lhunath 1340009907 learn Prepare literal data for injection into a URL path component or GET attribute: urlquote() { local c; while IFS= read -rd '' -n1 c; do printf '%%%02x' "'$c"; done <<< "$1"; }; curl "http://www.google.com/search?q=$(urlquote "$query")"