Bug #74212 [Fbk->NoF]: Prepare destroys some UTF-8 characters on Insert
| From: | php-bugs at lists dot php dot net | Date: | Sun, 19 Mar 2017 04:22:35 +0000 |
| Subject: | Bug #74212 [Fbk->NoF]: Prepare destroys some UTF-8 characters on Insert | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207930@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74212&edit=1
ID: 74212
Updated by: php-bugs@lists.php.net
Reported by: michael dot kaiser at winzeldorf dot de
Summary: Prepare destroys some UTF-8 characters on Insert
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: PDO MySQL
Operating System: Linux
PHP Version: 5.6.30
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2017-03-06 17:15:39] requinix@php.net
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-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