Chinese characters in PHP
Posted: Fri Apr 13, 2012 1:56 am
Client page:
Server page:
Problem is even if there is that chinese text in the database results is ZERO(none). If I print the POST value $name it displays the correct text with the chinese characters.
but if i store it in a variable, such as:
It produces results. how could this be, in POST it doesn't but static value declaration it does? My OS is XP SP3.
Is there a problem in the "internal" representation of chinese characters if it is in POST? Do I need to set something in my OS to support chinese representation?
Code: Select all
<head>
<meta http-equiv="Catchup Scheduler" content="text/html; charset=UTF-8">
</head>
<body>
<form action="next.php" method="POST" >
<input type="text" name="programme_name"></br>
<input type="submit">
</form>
</body>
Code: Select all
$name = $_POST['programme_name'];
mysql_query("SET character_set_client=utf8",$con);
mysql_query("SET character_set_connection=utf8", $con);
mysql_query("SET character_set_results=utf8", $con);
$query = "Select * from programme where Programme_name Like '%".$name."'";
but if i store it in a variable, such as:
Code: Select all
$name= "valuevalue ( 官话 )";
$query = "Select * from programme where Programme_name Like '%".$name."'";
Is there a problem in the "internal" representation of chinese characters if it is in POST? Do I need to set something in my OS to support chinese representation?