Gunnar Koppel kirjutas:
Thank you and all others! That's it. BTW, i always use uppercase
Seems my joy was too early. As i said, I alway use uppercase
filehandlers and so was in every real situation, where was this problem
with UTF<->modperl2.
As a script solution with STD* works fine, but as a handler it gives
same output as earlier.
My little test set for handler:
------
package test::utf;
use strict;
use Apache2::Const qw(:common);
use CGI;
use locale;
use utf8;
binmode STDIN, ":utf8";
binmode STDOUT, ":utf8";
our $q = ();
sub handler {
my @alpha = qw(a b c d e f g h i j k l m n o p q r s š z ž t u v õ ä ö
ü x y);
$q = new CGI;
print $q->header(-type=>"text/plain", -charset=>"UTF-8", -cookie=>'');
print "\u$_ " foreach @alpha;
print "\n";
return OK;
}
1;
------
apache2 conf:
------
<VirtualHost *>
DocumentRoot /home/www/test/pub
ServerName utf.test.com
PerlModule test::utf
SetHandler perl-script
PerlHandler test::utf
PerlSendHeader On
</VirtualHost>
------
If i run this little script (from command line, under PerlRun,
PerlRegistry or as CGI), i have proper output:
------
#!/usr/bin/perl
use strict;
use warnings;
use locale;
use utf8;
binmode STDIN, ":utf8";
binmode STDOUT, ":utf8";
use test::utf;
&test::utf::handler();
------
But not as a handler. Can't understand, why? Seems that binmode STD*,
":utf8" has no power here?
And still is the question: if std* are intentionally not valid
filehandlers, why some (multibyte) UTF characters are handled correctly
under modperl2 and other not?
--
TIA,
Gunnar Koppel