develooper Front page | perl.i18n | Postings from May 2007

Character Encoding (UTF-8) in PERL

Thread Next
From:
Oliver =?iso-8859-1?q?K=F6nig?=
Date:
May 10, 2007 00:08
Subject:
Character Encoding (UTF-8) in PERL
Message ID:
200705100904.03724.oliver@windfinder.com
Hello list,
we have used Debian (3.1) Sarge for almost 2 years on our serverand everything 
was encoded in UTF-8.

When Debain Etch (4.0) came out we read that everything in Etch now defaults 
to UTF-8 character encoding so we decided to upgrade from from Sarge to Etch.

Sarge
====
Kernel 2.4.27
Apache 2.0.54
mysql 4.0.24 
Perl 5.8.4

Etch
====
Kernel 2.6.18
Apache 2.2.3
mysql 5.0.32
Perl 5.8.8

Unfortunately after the upgrade the character encoding on our website was 
messed up and it looks like the reason for that is PERL.

The operating system and Apache seem to use UTF-8. So, that's good!

In mysql everything looks fine, too:
mysql> SHOW VARIABLES LIKE "character_set_%";
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

However a PERL script with dbh->do(SHOW VARIABLES LIKE "character_set_%"); 
returns:
character_set_client      latin1
character_set_connection  latin1
character_set_database    utf8
character_set_filesystem  binary
character_set_results     latin1
character_set_server      utf8
character_set_system      utf8
character_sets_dir        /usr/share/mysql/charsets/

How can we tell PERL to use UTF-8 as default encoding?

Thanks
-- 
Best regards,
Oliver König

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About