[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Perl : escape-koder til chars



Hej.

Jeg køre et CGI-script i perl, der oversætter escape-koder
fra en browser (http) til chars. Scriptet er vist forneden,
men kan det ikke gøres mere elegant ? Og findes der et perl-modul,
der kan gøre det ?

mvh.

Peter

sub correct_input {
  local ($mystr) = @_;
  $mystr =~ s/%0A//g;
  $mystr =~ s/%0D//g;
  $mystr =~ s/%20/ /g;
  $mystr =~ s/%21/!/g;
  #$mystr =~ s/%22/\"/g;
  $mystr =~ s/%23/\#/g;
  $mystr =~ s/%24/\$/g;
  $mystr =~ s/%25/%/g;
  $mystr =~ s/%26/&/g;
  $mystr =~ s/%27/\'/g;
  $mystr =~ s/%28/(/g;
  $mystr =~ s/%29/)/g;
  $mystr =~ s/%2C/,/g;
  $mystr =~ s/%2E/./g;
  $mystr =~ s/%2F/\//g;
  $mystr =~ s/%3B/;/g;
  $mystr =~ s/%3C/</g;
  $mystr =~ s/%3D/=/g;
  $mystr =~ s/%3E/>/g;
  $mystr =~ s/%3F/?/g;
  $mystr =~ s/%5B/[/g;
  $mystr =~ s/%5C/\\/g;
  $mystr =~ s/%5D/]/g;
  $mystr =~ s/%5E/^/g;
  $mystr =~ s/%60/`/g;
  $mystr =~ s/%7C/|/g;
  $mystr =~ s/%7B/{/g;
  $mystr =~ s/%7D/}/g;
  $mystr =~ s/%7E/~/g;
  $mystr =~ s/%A3/£/g;
  $mystr =~ s/%A4/¤/g;
  $mystr =~ s/%A7/§/g;
  $mystr =~ s/%BD/½/g;
  $mystr =~ s/%C4/Ä/g;
  $mystr =~ s/%C5/Å/g;
  $mystr =~ s/%C6/Æ/g;
  $mystr =~ s/%C8/È/g;
  $mystr =~ s/%C9/É/g;
  $mystr =~ s/%CF/Ï/g;
  $mystr =~ s/%D6/Ö/g;
  $mystr =~ s/%D8/Ø/g;
  $mystr =~ s/%DC/Ü/g;
  $mystr =~ s/%E4/ä/g;
  $mystr =~ s/%E5/å/g;
  $mystr =~ s/%E6/æ/g;
  $mystr =~ s/%E8/è/g;
  $mystr =~ s/%E9/é/g;
  $mystr =~ s/%EF/ï/g;
  $mystr =~ s/%F2/ò/g;
  $mystr =~ s/%F3/ó/g;
  $mystr =~ s/%F4/ô/g;
  $mystr =~ s/%F5/õ/g;
  $mystr =~ s/%F6/ö/g;
  $mystr =~ s/%F8/ø/g;
  $mystr =~ s/%FC/ü/g;
  $mystr =~ s/%2B/+/g;
  $mystr =~ s/%40/@/g;
  $mystr =~ s/%3A/:/g;
  return $mystr;
}

--
+----------------------------------------------------------+
| Kabel-TV over Internettet   --   http://www.streamtv.dk/ |
+----------------------------------------------------------+


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-09-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *