Thread CGI decode-encode Frage
(4 answers)
Opened by Kuerbis at 2011-08-22 11:19
Stimmt das so - ich sollte alle Strings von Hand encodeieren weil ein "binmode STDOUT, ':encoding(utf-8)';" würde verschickte Nichttext-Dateien zerstören?
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 #!/usr/local/bin/perl use warnings; use 5.012; use utf8; use Encode qw(decode encode); use CGI qw(:standard); my $in = decode 'utf-8', param( 'in' ) || 'Hello World'; print header( -charset => 'UTF-8' ), start_html(), p( encode 'utf-8', $in ), p( encode 'utf-8', 'eins' ), p( encode 'utf-8', 'zwei' ), p( encode 'utf-8', 'drei' ), p( encode 'utf-8', 'vier' ), p( encode 'utf-8', 'fünf' ), p( encode 'utf-8', 'sechs' ), end_html; Last edited: 2011-08-22 11:22:33 +0200 (CEST) |