DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Un-hex

02.25.2009
| 1979 views |
  • submit to reddit
        
#!/usr/bin/perl
#
# un-hex - convert a hexadecimal encoded url (i.e. with % signs) to ASCII
# By John
#

while (<>) {
    chomp() ;
    s/[%=]([A-F0-9][A-F0-9])/pack("C", hex($1))/egi;
    print "$_\n";
}