[cgiapp] Problem displaying French, sometimes
Ron Savage
ron at savage.net.au
Tue Sep 9 05:50:33 EDT 2008
Hi Mike
On Mon, 2008-09-08 at 09:23 +0100, Mike Tonks wrote:
> You got me there. I'm using mysql with utf8 and this works fine for
> me. I tend to agree with Peter that utf8 is the way to go.
I've tried to go the 'utf8' way....
(1) httpd.conf:
PerlSetEnv PGCLIENTENCODING UTF8
(2) startup.pl:
No change
(3) sites.fcgi
$ENV{'PGCLIENTENCODING'} = 'UTF8';
(4) populate.countries.pl:
This program does:
use Locale::SubCountry;
to load data into Postgres.
$ENV{'PGCLIENTENCODING'} = 'UTF8';
and
# encode destroys its 2nd parameter, so we protect it.
sub my_encode
{
my($name) = @_;
$name =~ s/(.+) \(SEE ALSO.+/$1/;
return encode('UTF-8', $name, Encode::FB_CROAK);
} # End of my_encode;
Note: See the pod for Encode, and in particular this note:
UTF-8 vs. utf8 vs. UTF8
(5) Sites.pm:
This module displays the data:
sub my_decode
{
my($name) = @_;
return decode('UTF-8', $name, Encode::FB_CROAK);
} # End of my_decode;
(6) Result:
The symptoms have reversed compared to my earlier msg.
AAAAAAAAAgggggggggghhhhhhhhhh
Now, the mod_perl execution path displays the correct data:
CÔTE D'IVOIRE
while the fastcgid execution path displays:
CÔTE D'IVOIRE
(7) Buy h-bomb on ebay. kill $self.
After all, what's the point :-(.
--
Ron Savage
ron at savage.net.au
http://savage.net.au/index.html
More information about the cgiapp
mailing list