|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30720 utf8 chars are not correctly inserted into db
Submitted: 2004-11-08 16:09 UTC Modified: 2004-11-10 17:39 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: bubu at cc dot lv Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5CVS-2004-11-08 (dev) OS: Windows 2000 SP4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: bubu at cc dot lv
New email:
PHP Version: OS:


 [2004-11-08 16:09 UTC] bubu at cc dot lv
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:
  $link = mysqli_connect('localhost', 'root', 'root', 'test');
  mysqli_query($link, "CREATE TABLE utf8_test(a CHAR(100)) CHARACTER SET 'utf8'");
  $text = '&#9472;?&#9532;&#298;&#9532;?'; // 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);
  echo ($text == $new_text ? "TRUE" : "FALSE");

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-10 17:39 UTC]
It works fine for me both with mysql_* & mysqli* and MySQL 5.0.1, so I suppose this is MySQL bug (see
Marking this report bogus then.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Jun 09 12:03:39 2023 UTC