#31176 [Opn->Fbk]: utf8 characters not recognized by PHP

From: Date: Tue, 21 Dec 2004 14:43:22 +0000
Subject: #31176 [Opn->Fbk]: utf8 characters not recognized by PHP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-70848@lists.php.net to get a copy of this message
ID: 31176 Updated by: iliaa@php.net Reported By: list at bgp5 dot net -Status: Open +Status: Feedback Bug Type: MySQL related Operating System: RH 9 & FC3 PHP Version: 4.3.10 New Comment: How did you escape the data on insert? Previous Comments: ------------------------------------------------------------------------ [2004-12-18 06:14:42] 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: 面 浏 荐 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31176&edit=1

« previous php.bugs (#70848) next »