|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74212 Prepare destroys some UTF-8 characters on Insert
Submitted: 2017-03-06 16:25 UTC Modified: 2017-03-19 04:22 UTC
From: michael dot kaiser at winzeldorf dot de Assigned:
Status: No Feedback Package: PDO MySQL
PHP Version: 5.6.30 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: michael dot kaiser at winzeldorf dot de
New email:
PHP Version: OS:


 [2017-03-06 16:25 UTC] michael dot kaiser at winzeldorf dot de
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);
// 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")";
Results in entry "Elit İşcan".


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-06 17:15 UTC]
-Status: Open +Status: Feedback
 [2017-03-06 17:15 UTC]
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.
 [2017-03-19 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 06:01:26 2024 UTC