I tried to read the vietnamese address from Mysql databases through perl program. But it display some special characters which is not recognize. When i see the string in phpMyAdmin is ok. And using php to retrieve and print the string also no problem. Just only using perl to print out the string will become weird.
Original word
QL37, Phố Vôi, tt. Vôi, Lạng Giang, Bắc Giang, Vietnam
After print become
QL37, Phoá Voâi, tt. Voâi, Laïng Giang, Baéc Giang, Vietnam
The database structure
CREATE TABLE `address` (
`Address_Id` int(11) NOT NULL,
`Coordinate_Lat` float(15,6) NOT NULL,
`Coordinate_Long` float(15,6) NOT NULL,
`Address` varchar(300) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Perl Code
my $sql = "SELECT * FROM `address`";
my $sth = $DBIconnect->prepare($sql);
$sth->execute or die "SQL Error: $DBIconnect::errstr\n";
while (my $row = $sth->fetchrow_hashref) {
print $row->{'Address'};
}
Print Screen