#31176 [NEW]: utf8 characters not recognise by PHP
| From: | list at bgp5 dot net | Date: | Sat, 18 Dec 2004 05:14:44 +0000 |
| Subject: | #31176 [NEW]: utf8 characters not recognise by PHP | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-70585@lists.php.net to get a copy of this message | ||
From: list at bgp5 dot net
Operating system: RH 9 & FC3
PHP version: 4.3.10
PHP Bug Type: MySQL related
Bug description: utf8 characters not recognise by PHP
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:
é¢
æµ
è
--
Edit bug report at http://bugs.php.net/?id=31176&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31176&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31176&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31176&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31176&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31176&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31176&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31176&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31176&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31176&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31176&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31176&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31176&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31176&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31176&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31176&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31176&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31176&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31176&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31176&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31176&r=mysqlcfg