I forgot to add my small testing script (tested with OS X):
#!/bin/sh
teststr=$1
echo "$teststr" | awk -v dummy="'" '
function url_encode(rawURL) {
cleanURL=""
nonURLPos=match(rawURL,/[^[:alnum:]]/)
while( nonURLPos > 0 ) {
rawChar=substr(rawURL,nonURLPos,1)
replaceChar=sprintf("%02x"...