sub URI_ESCAPE { my ($text) = @_; return undef unless defined $text; my (%escapes); for (0..255) { $escapes{chr($_)} = sprintf("%%%02X", $_) } $text =~ s/([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'()])/$escapes{$1}/g; $text; }