P> eyes without hate GBK Unicode UTF8 Kanji Conversion
The conversion of Chinese characters in PHP has always been a tricky business.
The class has four filters "&#[dec];", "& #x [hex];", "%u[hex]", "UTF8 conversion"
Easy to use, but also can customize the filter to do their favorite operation
qswhu.php Download from here
/user/qswh/qswhu.zip
Class qswhu{
var $qswhData;
function Qswhu ($filename = "qswhu.php") {
$this->qswhdata=file ($filename);
}
function decode ($STR, $pattern =0) {
$arr =array ("/&# (w+);/iu", "/((%WW) +)/I", "/%u (w{4,5})/iu");
if (Is_integer ($pattern)) {
if ($pattern >=count ($arr)) Die ("Invalid Function");
$pattern = $arr [$pattern];
}
Return Preg_replace_callback ($pattern, Array ($this, "U2GB"), $STR);
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.