Character Encoding (UTF-8) in PERL
[email protected] (Oliver König) Thu, 10 May 2007 09:04:03 +0200
| Newsgroups | perl.i18n |
|---|---|
| Organization | Windfinder.com |
| Message-ID | <[email protected]> |
Hello list, we have used Debian (3.1) Sarge for almost 2 years on our serverand everyth= ing=20 was encoded in UTF-8. When Debain Etch (4.0) came out we read that everything in Etch now default= s=20 to UTF-8 character encoding so we decided to upgrade from from Sarge to Etc= h. Sarge =3D=3D=3D=3D Kernel 2.4.27 Apache 2.0.54 mysql 4.0.24=20 Perl 5.8.4 Etch =3D=3D=3D=3D 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=20 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 =A0 =A0 =A0 =A0 =A0 =A0| Value =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0| +--------------------------+----------------------------+ | character_set_client =A0 =A0 | utf8 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 | | character_set_connection | utf8 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 | | character_set_database =A0 | utf8 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 | | character_set_filesystem | binary =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= | | character_set_results =A0 =A0| utf8 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 | | character_set_server =A0 =A0 | utf8 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 | | character_set_system =A0 =A0 | utf8 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 | | character_sets_dir =A0 =A0 =A0 | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ However a PERL script with dbh->do(SHOW VARIABLES LIKE "character_set_%");= =20 returns: character_set_client =A0 =A0 =A0latin1 character_set_connection =A0latin1 character_set_database =A0 =A0utf8 character_set_filesystem =A0binary character_set_results =A0 =A0 latin1 character_set_server =A0 =A0 =A0utf8 character_set_system =A0 =A0 =A0utf8 character_sets_dir =A0 =A0 =A0 =A0/usr/share/mysql/charsets/ How can we tell PERL to use UTF-8 as default encoding? Thanks =2D-=20 Best regards, Oliver K=F6nig