Re: Character set problem
Posted by:
Alex NS
Date: November 25, 2009 04:34AM
Hi,
I've had a look to that but I haven't been able to solve the problem yet:
This is the status of my db by default:
Server characterset: latin1
Db characterset: utf8
Client characterset: latin1
Conn. characterset: latin1
If I do a SET NAMES utf8; I get this for the current session:
Server characterset: latin1
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
Is it a problem that the server characterset is still latin1?
I'm trying to migrate data form a MS SQL database in UTF8 to my MySql database with a Perl script, so following your information I've done this:
my $dbh1 = DBI->connect(
'dbi:Sybase:server=' .
$db{'live'}{'S_DBI_HOST'},
$db{'live'}{'S_DBI_USER'},
$db{'live'}{'S_DBI_PASSWD'},
{
Warn => 1,
PrintWarn => 1,
PrintError => 1,
AutoCommit => 1,
mysql_enable_utf8 => 1,
on_connect_do => [ "SET NAMES 'utf8'", "SET CHARACTER SET + 'utf8'" ]
}
) or die "Can't connect to dbh: $DBI::errstr";
my $db="DBI:mysql:".$VMSTK_DB;
my $dbh2 = DBI->connect($db,$VMSTK_DB_USER, $VMSTK_DB_PASSWD,
{ RaiseError => 1, AutoCommit => 0, mysql_enable_utf8 => 1 })
or die "Couldn't connect to database: " . DBI->errstr;
$dbh2->{'mysql_enable_utf8'} = 1;
my $sql = qq{SET NAMES 'utf8';};
$dbh2->do($sql);
I'm still getting the same error. Any suggestion, please?