Re: Character Encoding (UTF-8) in PERL

[email protected] (Oliver König) Sun, 13 May 2007 17:52:54 +0200
Newsgroups perl.i18n
Organization Windfinder.com
Message-ID <[email protected]>
On Sunday 13 May 2007 17:14:43 you wrote:
> Krzysztof Krzy??aniak dijo [Thu, May 10, 2007 at 09:48:46AM +0200]:
> > after connection do query "set NAMES utf8"
> > http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html
> >
> > or (from man DBD::mysql):
> >
> > mysql_enable_utf8
> >
> > This attribute determines whether DBD::mysql should assume strings
> > stored in the database are utf8.  This feature defaults to off.
> >
> > When set, a data retrieved from a textual column type (char, varchar,
> > etc) will have the UTF-8 flag turned on if necessary.  This enables
> > character semantics on that string.  You will also need to ensure that
> > your database / table / column is configured to use UTF8.  See Chapter
> > 10 of the mysql manual for details.
> >
> > Additionally, turning on this flag tells MySQL that incoming data should
> > be treated as UTF-8.  This will only take effect if used as part of the
> > call to connect().  If you turn the flag on after connecting, you will
> > need to issue the command "SET NAMES utf8" to get the same effect.
> >
> > This option is experimental and may change in future versions.
>
> Ummm... This last line makes me not too confident about what I'm going
> to propose, but anyway...
>
> I think that, as Etch is by default installed with UTF on everywhere,
> we should propose changing this default, so that MySQL connections are
> also UTF by default. This could enter Etch 4.0r1 (or further). What do
> you think?
>
My mysql settings are fine. The problem is PERL.=20

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 the command dbh->do(SHOW VARIABLES LIKE "character_set_%");  excute=
d=20
in a PERL script 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/

Everybody is blaming mysql but it is obvious to me that PERL is the problem=
=2E=20
How do I configure PERL tu use UTF-8 as default???

=2D-=20
Oliver K=F6nig

Windfinder.com
Knorrstr. 24 Hinterhaus
24106 Kiel
Germany
phone +49 431-8008643
VoIP +49 431-5569222
fax +49 431-8008644
Mobile +49 177-4933362
[email protected]
www.windfinder.com