$url_string =~ s/([^[:alnum:]])/sprintf '%%%02x', ord($1)/eg; # thanks for the 02, ikegami