Reputation: 43
I have the following php code. Connection is OK but it doesn't show the Arabic text stored in the database correctly. Just question marks.
$mysqlPDO = new PDO('mysql:host='.HOSTNAME.';charset=utf8;dbname='.DBNAME.'',DBUSERNAME, DBPASSWORD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES UTF8"));
$stmt = $mysqlPDO->prepare("SHOW TABLES LIKE 'main_patches_version'");
$stmt->execute();
The DB collation is already set to utf8_general_ci and the table has utf8 as charset. This application is calling Zend libraries which I'm not aware of. I checked that the HTML has utf8 as encoding type. any suggestion? I'm using xampp server, php version 5.5.11, mysql version 5.6.16
Upvotes: 1
Views: 2310
Reputation: 43
I found the solution here http://akrabat.com/php/utf8-php-and-mysql/
I unmarked
character_set_server=utf8
from my.ini file and it works.
Thanks all
Upvotes: 2
Reputation: 5597
Make sure your DB collation is set to use utf8_general_ci
or utf8mb4_general_ci
.
Upvotes: 1