Mine
public text v1 · immutablefunction urlencode() { #new
local atom
echo "$1"|sed -r 's/[a-zA-Z0-9\.-]+|./:&:\n/g'|while read atom;do
atom="$(echo "$atom"|sed 's/^://;s/:$//')"
test "x$atom" == x && echo -n "%0a" && continue
test $(echo -n "$atom"|grep -c '[a-zA-Z0-9\.-]\+') -eq 1 && echo -n "$atom" && continue
echo -n "%$(echo -n "$atom"| od -t x1 -A n)"
done|sed 's/ //g;s/%20/+/g'
}