in reply to CGI.pm: "Malformed UTF-8 character" in apache's error.log
#!/usr/bin/perl -COE use CGI; use CGI::Carp qw(fatalsToBrowser); use utf8; use Encode; my $cgi = new CGI; my $formtext = decode("utf8", $cgi->param("formtext") ); # this may be + abc or contain chinese my $filename = $cgi->param('file'); my $fh_in = $cgi->upload('file'); open(my $fh_out, '>', "/var/www/clipland/www.clipland.com/$filename") +or die $!; binmode $fh_in; binmode $fh_out; local $/ = \4096; # Don't wait to find "\n" while (<$fh_in>) { print $fh_out $_; } $cgi->header(-charset => 'utf-8'); print $cgi->header(); print "$filename has been successfully uploaded... Now some umlauts: ä +öü";
|
|---|