courierb has asked for the wisdom of the Perl Monks concerning the following question:
actally i want to know the equevelent of module or code perl which do the same task .function encode(str){ return str.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0). +replace(/(%u)(\w{4})/gi,"&#x$2;")}); } function decode(str){ return str.replace(/&#x/g,'%u').replace(/;/g,''); }
Thanks in advance Cliff<html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>tf8 Example</title> </head> <body> <form method="post" action="7bit.cgi"> <p>word: <input name="word" type="text"> <input type="submit" name="Submit" value=" submit "> </form> </body> </html> -------7bit.cgi--- #!/usr/bin/perl -w use CGI; use HTML::Entities; use utf8; $query = new CGI; $secretword = $query->param('word'); $remotehost = $query->remote_host(); my $a = $secretword; $a = decode_entities($a); #print encode_entities($a)."\n"; print $query->header( -charset=>'utf-8' ); print "$a";
|
|---|