• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

char codes passed using querystring

in my script in get values that are passed to it by using this code

 if ($ENV{'REQUEST_METHOD'} eq POST)
                         {
                         $DataLength=$ENV{'CONTENT_LENGTH'};
                         read (STDIN, $QueryString, $DataLength);
                         }
                         else
                         {
                         $QueryString = $ENV{'QUERY_STRING'};
                         }

                         #Splitting the pairs and putting them in a list
                         @NameValuePairs = split (/&/, $QueryString);  

the problem is that i want to send
french characters in the querystring
these characters look all funny when print them.....

for instance if i have a capital A with a little line over it starting from bottom right and going to the top left (ascii code #192) and i try to print it after it is put into querystring i get
%C0

how can i be sure that the codes will remain unaffected?
0
boofulls
Asked:
boofulls
1 Solution
 
shlomoyCommented:
use URI::Escape;
$str  = uri_unescape($safe);

where $safe is the escaped string.


URI is a perl module which can be downloaded from CPAN:
http://search.cpan.org/
0
 
malecCommented:
foreach (@NameValuePairs){
  tr/+/ / ;
  ($name,$value)=  split(/=/) ;
  $value=~ s/%(..)/pack("c",hex($1))/ge ;  
$name=~s/%(..)/pack("c",hex($1))/ge ;   $in{$name} = $value;
}
0
 
boofullsAuthor Commented:
malec's answer was easier to use....
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now