<?php
$value = "ខ្មែរសាកល្បង Test";
preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $value);
/*output
Test
<?phpand set proper charset in the HTML Head section
$dbhost = 'localhost';
$dbuser = 'root';
$dbpwd = '';
$dbname = 'test';
$dbConn = mysql_connect ($dbhost, $dbuser, $dbpwd) or die ('MySQL connect failed. ' . mysql_error());
mysql_select_db($dbname) or die('Cannot select database. ' . mysql_error());
mysql_query("SET NAMES utf8");
function dbQuery($sql)
mysql_query("SET NAMES utf8"); //the main trick
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
Subscribe to:
Posts (Atom)