It is strange. CGI works ok, but i was unable to get correct output even
from module even first time. It seems to be ok for me after switching
from perl-script to modperl handler.
apache 2.0.48
mod_perl 1.99_14
perl 5.0.8
<Location /unitest>
SetHandler modperl
# perl-script does not work - don't know why
# SetHandler perl-script
PerlResponseHandler Unitest
</Location>
Here is changed handler and startpage code
sub handler {
my $r = shift;
$r->print( header(-type => "text/html", -charset => "utf-8"));
$r->print( start_html(
# This seems to be no important?
-encoding => 'utf-8',
-title => "Simple UTF 8 test"));
$r->print( "\n\n");
# page calls
unless (param('VertDo')) {
$r->print(&startpage());
}
$r->print( "\n\n", end_html);
return Apache::OK;
#1;
}
sub startpage {
my %uni = &unihash;
my $p = '';
$p = "\n";
$p .= start_form(-method=>"get", -action=>"/test.html");
$p .= h1("Unicode test: Page 1");
$p .= '<table border="1" cellpadding="5">';
my $tablinedef = "<tr>" . "<td>%s</td>" x 3 . "</tr>\n";
# Headerline
$p .= sprintf $tablinedef,
"description", "language", "char in unicode";
foreach (sort keys %uni) {
$p .= sprintf $tablinedef,
$_ ,
$uni{$_}->{language},
textfield(-name=>$_,
-default=>$uni{$_}->{character}, -size=>50, -maxlength=>80);
}
$p .= '</table>';
$p .= hidden(-name=>'VertDo',
-default=>['test unicode']);
$p .= submit(-name=>'Do',
-value=>'test unicode');
$p .= endform;
return $p;
}
Hope it helps
Roman
On Fri, Feb 11, 2005 at 11:47:49AM +0000, angie ahl wrote:
> I've looked into it further and stripped it right back to the start.
>
> Now I just have the unicode chars hard coded in the script and
> printing them to a table.
>
> I'm not even passing them through a form now, just printing them.
>
> In CGI mode it works perfectly and in MP2 mode it loads fine the first
> time after apache or the browser is restarted. Then goes kaboom, ie
> gibberish
>
> Here's both scripts.
[...]
--
best regards
Ing. Roman Vasicek
software developer
+----------------------------------------------------------------------------+
PetaMem s.r.o., Ocelarska 1, 190 00 Praha 9 - Liben, Czech Republic
http://www.petamem.com/