Fox has asked for the wisdom of the Perl Monks concerning the following question:
As you can see, I tried some solutions I found out there already, but none of that worked. The code prints:use strict; use warnings; use DBI; binmode(STDOUT, ":utf8"); my $dbo = DBI->connect('dbi:mysql:testdb:127.0.0.1:3306','','') or die + $!; $dbo->do('SET NAMES utf8'); $dbo->{'mysql_enable_utf8'} = 1; my $str = "\x{72d0}\x{306e}\x{5de5}\x{4f5c}\x{5ba4}"; print "$str\n"; my $s = $dbo->prepare("INSERT INTO test VALUES(?);"); $s->execute($str);
the mysql server version is 5.1.41, DBI is 1.615 and perl is 5.12.1+-----------------+ | testcol | +-----------------+ | ????? | +-----------------+
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Inserting UTF-8 on Mysql using DBI
by Corion (Patriarch) on Oct 15, 2010 at 06:58 UTC | |
by Fox (Pilgrim) on Oct 15, 2010 at 10:53 UTC | |
by Corion (Patriarch) on Oct 15, 2010 at 14:10 UTC | |
by Fox (Pilgrim) on Oct 16, 2010 at 12:48 UTC | |
by Corion (Patriarch) on Oct 16, 2010 at 17:10 UTC | |
by afoken (Chancellor) on Oct 18, 2010 at 14:43 UTC |