All pastes #445419 Raw Edit

Mine

public text v1 · immutable
·published 2007-04-17 21:12 UTC
rendered paste body
function 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'
}