Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

rfc2396 url encoding



Anyone have a way of doing this better?

urlencode() {
  local input=${1} i j

  for i in {1..${#input}}
  do
    j=$input[i]
    if [[ $j == [A-Za-z0-9_.!~*\'\(\)-] ]]
    then
      print -n $j
    else
      print -n \%$(( [##16]#j))
    fi
  done
}



Messages sorted by: Reverse Date, Date, Thread, Author