BASH | URLENCODE

For each character in string do

 # IN="\\";printf -v OUT '%%%02x' "'$IN"; echo $OUT

or

 # echo "this & that" | perl -MURI::Escape -ne 'chomp;print uri_escape($_),"\n"'