Bug #74212 [Opn->Fbk]: Prepare destroys some UTF-8 characters on Insert
Edit report at https://bugs.php.net/bug.php?id=74212&edit=1
ID: 74212
Updated by: requinix@php.net
Reported by: michael dot kaiser at winzeldorf dot de
Summary: Prepare destroys some UTF-8 characters on Insert
-Status: Open
+Status: Feedback
Type: Bug
Package: PDO MySQL
Operating System: Linux
PHP Version: 5.6.30
Block user comment: N
Private report: N
New Comment:
This is unlikely to be a bug with PDO.
Check that you are using UTF-8 (or whichever encoding) for all aspects of the database - do
"SHOW VARIABLES LIKE '%conn%'" to see. Then make sure whatever you're using
to read the database is connecting properly as well, and that the output is in UTF-8 too. And
obviously, the file must be in UTF-8 encoding as well since you're hardcoding the string in it.
Also check that you get the same behavior with mysql/mysqli using the exact same connection
parameters, and with PDO's regular (non-prepared) queries.
Previous Comments:
------------------------------------------------------------------------
[2017-03-06 16:25:14] michael dot kaiser at winzeldorf dot de
Description:
------------
It is not possible to insert turkish UTF8 characters (like in the name Elit İÅcan) into a
MySQL database via PDO.
I tried MyISAM tables and InnoDB tables.
I tried utf8, utf16, utf32, utfmb4 and ISO 8859-9 Turkish (latin 5)
Test script:
---------------
// Does not work:
$query = "INSERT INTO utf8test (Name) VALUES ("Elit İÅcan")";
$pdo = $db->prepare($query);
$pdo->execute();
// Results in entry "Elit ??can".
Expected result:
----------------
Database entry should read "Elit İÅcan"
Actual result:
--------------
Database entry is "Elit ??can"
Old MySQL command works:
$query = "INSERT INTO utf8test (Name) VALUES ("Elit İÅcan")";
mysql_query(query);
Results in entry "Elit İÅcan".
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74212&edit=1
Thread (3 messages)