Re: Character Encoding (UTF-8) in PERL

2007-05-13 08:54:28
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"

or (from man DBD::mysql):


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. 

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

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

Oliver König
Knorrstr. 24 Hinterhaus
24106 Kiel
phone +49 431-8008643
VoIP +49 431-5569222
fax +49 431-8008644
Mobile +49 177-4933362

<Prev in Thread] Current Thread [Next in Thread>