[mp2] utf8 data garbled on second + subsequent loads
[prev]
[thread]
[next]
[Date index for 2005/02/10]
Firstly may I appologise for the length of this, I fear I won't get to
the bottom of it otherwise.
All of the following is being done on OS X 10.3
Server: Apache/2.0.52 (Unix) mod_perl/1.999.21 Perl/v5.8.6
I noticed today that some of my utf8 data was becoming corrupted but
couldn't see why.
Hebrew and Arabic were fine but characters like =C3=BC were becoming garble=
d.
So I went back to a basic test script I wrote for testing utf8 and
this was fine running under cgi mode.
So I converted the cgi script to a package.=20
Wrapped the main code in sub handler {} and added return Apache::OK
both the cgi script and package have:
use strict;
use warnings;
use 5.008006;
use utf8;
use DBI;
use CGI (':standard');
use Encode qw/is_utf8 decode/;
binmode(STDOUT, ":utf8");
When I load the cgi script everything is fine every time.
When I load the package it's fine the first time but becomes garbled
on susbsequent loads.
Restarting apache makes the first load fine again. Quitting the
browser and relaunching it also solves the problem.
Here's the httpd.conf info:
PerlModule ModPerl::Registry
<FilesMatch "\.html$">
=09SetHandler perl-script=20
=09Perlhandler unidbtest
</FilesMatch>
I'm not sure if ModPerl::Registry is involved or not. I've tried both
perl-script and modperl as the handler.
First load I get like this as the output (whole page so you can see
the meta tags etc):
<?xml version=3D"1.0" encoding=3D"utf-8"?>
<!DOCTYPE html
=09PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
=09 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=3D"http://www.w3.org/1999/xhtml" lang=3D"en-US"
xml:lang=3D"en-US"><head><title>Simple UTF 8 test</title>
</head><body>
<form method=3D"get" action=3D"/test.html"
enctype=3D"application/x-www-form-urlencoded">
<h1>Unicode test: Page 1</h1><table border=3D"1"
cellpadding=3D"5"><tr><td>description</td><td>language</td><td>char in
unicode</td></td>
<tr><td>abimer</td><td>french</td><td><input type=3D"text" name=3D"abimer"
value=3D"ab=C3=AEmer" size=3D"50" maxlength=3D"80" /></td></td>
<tr><td>angies</td><td>mixed</td><td><input type=3D"text" name=3D"angies"
value=3D"=C5=82=C3=A7=E2=98=BA=C4=84=E2=98=BA=C4=84re=C3=A7enu=E2=98=BA" si=
ze=3D"50" maxlength=3D"80" /></td></td>
<tr><td>aogonec</td><td>polish</td><td><input type=3D"text"
name=3D"aogonec" value=3D"=C4=84" size=3D"50" maxlength=3D"80" /></td></td>
<tr><td>citroen</td><td>french</td><td><input type=3D"text"
name=3D"citroen" value=3D"citro=C3=ABn" size=3D"50" maxlength=3D"80" /></td=
></td>
<tr><td>disco</td><td>french</td><td><input type=3D"text" name=3D"disco"
value=3D"discoth=C3=A8que" size=3D"50" maxlength=3D"80" /></td></td>
<tr><td>hebrew_alef</td><td>hebrew</td><td><input type=3D"text"
name=3D"hebrew_alef" value=3D"=D7=90" size=3D"50" maxlength=3D"80" /></td><=
/td>
<tr><td>lslash</td><td>polish</td><td><input type=3D"text" name=3D"lslash"
value=3D"=C5=82" size=3D"50" maxlength=3D"80" /></td></td>
<tr><td>recenu</td><td>french</td><td><input type=3D"text" name=3D"recenu"
value=3D"re=C3=A7enu" size=3D"50" maxlength=3D"80" /></td></td>
<tr><td>smiley</td><td>none</td><td><input type=3D"text" name=3D"smiley"
value=3D"=E2=98=BA" size=3D"50" maxlength=3D"80" /></td></td>
<tr><td>zcaron</td><td>czech</td><td><input type=3D"text" name=3D"zcaron"
value=3D"=C5=BD" size=3D"50" maxlength=3D"80" /></td></td>
</table><input type=3D"hidden" name=3D"VertDo" value=3D"test unicode"=20
/><input type=3D"submit" name=3D"Do" value=3D"test unicode"
/><div></div></form>
</body></html>
on subsequent loads the following happens:
ab=C3=AEmer becomes ab=EF=BF=BDmer
citro=C3=ABn becomes citro=EF=BF=BDn
and so on.
If I leave my machine alone for a while and then load the page I get
correct output again, subsequent loads are garbled again.
really very confused about what's going on.
What to do next? I'm happy to put both scripts somewhere for download
if anyone wants to replicate the problem.
Thanks
Angie
 |
[mp2] utf8 data garbled on second + subsequent loads
angie ahl 23:51 on 10 Feb 2005
|