1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/usr/bin/perl use strict; use CGI -utf8; my $c = CGI->new; print "Content-Type: text/html; charset=UTF-8\n\n"; if($c->param){ my $x = $c->param('x'); print "$x <br>"; print length($x), "<br>"; } else{ print qq( <form action="$ENV{SCRIPT_NAME}"> <input name="x"> <input type="submit"> </form> ); }
print "$x <br>"
binmode STDOUT, ':encoding(UTF-8)';
1
2
3
4
$ /usr/bin/perl code_152036_1.txt x=%c3%a4
Content-Type: text/html; charset=UTF-8
ä <br>1<br>