たぶん、このツアーはあなたがヒットしているものに光を当てるでしょう? 私はchr2
あなたの問題がどこにあると推測しています。
use strictures;
use utf8;
use DBI;
my $dbh = DBI->connect("dbi:SQLite::memory:", undef, undef,
{ sqlite_unicode => 1,
PrintError => 1 } );
$dbh->do(<<"");
CREATE TABLE moo (
name TEXT
,string TEXT )
my $insert = $dbh->prepare("INSERT INTO moo VALUES ( ?, ? )");
my %reg = ( raw => "®", # note "use utf8;"
"chr" => chr(174) );
while ( my ( $name, $reg ) = each %reg )
{
$insert->execute($name, $reg);
}
# And a couple without placeholders (which we all know is EVIL, right?)
$dbh->do(<<"");
INSERT INTO moo VALUES( "raw2", "®" )
my $reg = chr(174);
$dbh->do(<<"");
INSERT INTO moo VALUES( "chr2", "$reg" )
my $sth = $dbh->prepare("SELECT * FROM moo");
$sth->execute;
binmode STDOUT, ":encoding(UTF-8)";
while ( my $row = $sth->fetchrow_hashref )
{
print $row->{name}, " -> ", $row->{string}, $/;
}
__DATA__
chr -> ®
raw -> ®
raw2 -> ®
"\x{00ae}" does not map to utf8.
chr2 -> \xAE