0

I've recently started started using PDO and have hit a brick wall with character encoding. I have a mysql table set to UTF8,

in the head of my web page and my connection string is

$db = new PDO("mysql:host=$mysqlserver;dbname=$mysqldatabase;charset=utf8", $mysqluser, $mysqlpassword,
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"));

I've tried as many permutations of those as I can find on the web and yet when I use PDO, some characters are not displaying correctly that are fine with mysqli:

× (the times special character) is correct with mysqli but displays as × when using PDO.

I've probably made a novice mistake somewhere but I can't track it down.

Mihai
  • 26,325
  • 7
  • 66
  • 81
KDavies
  • 23
  • 3
  • Look here http://stackoverflow.com/questions/279170/utf-8-all-the-way-through – Mihai Mar 06 '15 at 10:54
  • Thanks Mihai but I'd already found that page, the only thing I'd missed was the "mb4" on the end of "charset=utf8" but that's made no difference. What's got me lost is that fact that all I've done is convert from mysqli to PDO and this has got me so flummoxed I'm thinking of moving back again. – KDavies Mar 06 '15 at 11:23

0 Answers0