php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31176 utf8 characters not recognized by PHP
Submitted: 2004-12-18 06:14 UTC Modified: 2004-12-29 01:00 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: list at bgp5 dot net Assigned:
Status: No Feedback Package: MySQL related
PHP Version: 4.3.10 OS: RH 9 & FC3
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: list at bgp5 dot net
New email:
PHP Version: OS:

 

 [2004-12-18 06:14 UTC] list at bgp5 dot net
Description:
------------
Hi,

The web browser display the following characters correctly, however PHP unable to insert the characters properly into MySQL. I am using the latest MYSQL 4.1.7 and I have checked with MySQL, that their engine able to support utf8 and I have configured with charset=utf8.

These are the characters:   

面
浏
荐

MySQL table displays after insert via PHP:

???
???
???

Table description:
ENGINE=MyISAM DEFAULT CHARSET=utf8

It seems like PHP cannot insert certain symbol.


Reproduce code:
---------------
Insert the following characters through web using PHP into mysql table with Form charset utf8:

面
浏
荐

Try this simple code, copy and paste the characters, it doesn't work for me.
The table still displays question mark "??".

<html>
<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">

<form accept-charset=utf-8 method=post action="">

<textarea name=ta cols=28 rows=6></textarea>
<input type=submit>
</form>

</html>

<?php
$data = $HTTP_POST_VARS['ta'];

echo "<br><br>characters: $data";

$conn = mysql_connect("localhost", "root", "test") or die(mysql_error());
mysql_select_db('bug', $conn) or die(mysql_error());

$q = "INSERT into bug (message) values ('$data')";
mysql_query($q, $conn);

?>



Expected result:
----------------
Input these characters:   

面
浏
荐

MySQL table displays after insert via PHP:

???
???
???


Actual result:
--------------
Input these characters:   

面
浏
荐

MySQL table should display after insert via PHP:

面
浏
荐

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-21 15:43 UTC] iliaa@php.net
How did you escape the data on insert?
 [2004-12-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC