Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -wT
- use strict;
- use CGI;
- # variables
- my ($in, $from_file, $from_url);
- # HTTP header
- print qq|Content-type: text/html; charset=utf-8nn|;
- # from utf-8 file
- open($in, '<', './utf-8.txt');
- $in or die $!;
- ($from_file) = <$in>;
- print "<h1>from utf-8 file</h1>n";
- print "<p>character: ", $from_file, "</p>n";
- print '<p>length: ', length($from_file), "</p>n";
- # from url encoded
- print "<h1>from url encoded</h1>n";
- $from_url = '%F1';
- $from_url = CGI::unescape($from_url);
- print "<p>character: ", $from_url, "</p>n";
- print '<p>length: ', length($from_url), "</p>n";
- utf-8.txt: UTF-8 Unicode text, with no line terminators
- Distributor ID: Ubuntu
- Description: Ubuntu 16.04.2 LTS
- Release: 16.04
- Codename: xenial
Add Comment
Please, Sign In to add comment