Guest User

Untitled

a guest
Oct 16th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #!/usr/bin/perl -wT
  2. use strict;
  3. use CGI;
  4.  
  5. # variables
  6. my ($in, $from_file, $from_url);
  7.  
  8. # HTTP header
  9. print qq|Content-type: text/html; charset=utf-8nn|;
  10.  
  11. # from utf-8 file
  12. open($in, '<', './utf-8.txt');
  13. $in or die $!;
  14. ($from_file) = <$in>;
  15. print "<h1>from utf-8 file</h1>n";
  16. print "<p>character: ", $from_file, "</p>n";
  17. print '<p>length: ', length($from_file), "</p>n";
  18.  
  19. # from url encoded
  20. print "<h1>from url encoded</h1>n";
  21. $from_url = '%F1';
  22. $from_url = CGI::unescape($from_url);
  23. print "<p>character: ", $from_url, "</p>n";
  24. print '<p>length: ', length($from_url), "</p>n";
  25.  
  26. utf-8.txt: UTF-8 Unicode text, with no line terminators
  27.  
  28. Distributor ID: Ubuntu
  29. Description: Ubuntu 16.04.2 LTS
  30. Release: 16.04
  31. Codename: xenial
Add Comment
Please, Sign In to add comment