#30720 [Opn->Bgs]: utf8 chars are not correctly inserted into db
| From: | tony2001@php.net | Date: | Wed, 10 Nov 2004 16:39:16 +0000 |
| Subject: | #30720 [Opn->Bgs]: utf8 chars are not correctly inserted into db | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-68900@lists.php.net to get a copy of this message | ||
ID: 30720
Updated by: tony2001@php.net
Reported By: bubu at cc dot lv
-Status: Open
+Status: Bogus
Bug Type: MySQLi related
Operating System: Windows 2000 SP4
PHP Version: 5CVS-2004-11-08 (dev)
New Comment:
It works fine for me both with mysql_* & mysqli* and MySQL 5.0.1, so I
suppose this is MySQL bug (see http://bugs.mysql.com/bug.php?id=6527).
Marking this report bogus then.
Previous Comments:
------------------------------------------------------------------------
[2004-11-08 16:09:03] bubu at cc dot lv
Description:
------------
In MySQL 4.1.7 version, any text in table with charset type UTF-8, are
not correctly inserted by mysqli_fetch_row function. UTF-8 text is
inserted into tables correctly. When looking in some mysql management
tool (like MySQL Control Center or MySQL Query Browser or command line
mysql) all text are displayed incorrectly. Executed in commandline
INSERT command correctly inserts utf-8 characters.
Reproduce code:
---------------
<?php
$link = mysqli_connect('localhost', 'root', 'root',
'test');
mysqli_query($link, "CREATE TABLE utf8_test(a CHAR(100)) CHARACTER
SET 'utf8'");
$text = '─ü┼Ī┼å'; // any text non-ASCII text
(in UTF-8)
mysqli_query($link, "INSERT INTO utf8_test VALUES ('$text')");
$res = mysqli_query($link, "SELECT * FROM utf8_test");
list($new_text) = mysqli_fetch_row($res);
mysqli_free_result($res);
mysqli_close($link);
echo ($text == $new_text ? "TRUE" : "FALSE");
?>
Expected result:
----------------
TRUE
Actual result:
--------------
FALSE
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30720&edit=1