Very bitter and boring to discover that the HKSCS problem that has always been troubling PHP has been supported. Only the name is not called Hk-scs, called Big5-hkscs.
The following is the solution for the HK supplemental Character set:
The HTML page is UTF-8,
Before writing into the repository: iconv (' Big5-hkscs ', ' UTF8 ', $string)
To be Unicode, use the following function
function String2unicode ($data, $language)
{
$data = NL2BR (Trim ($data));
$data = Str_replace ('
', Chr (+), $data);
$str = ";
Preg_match_all ("/[\x80-\xff"?). /", $data, $ar);
Debug ($ar);
foreach ($ar [0] as $v)
{
if ($v! = "&& $v!=chr (13))
{
$str. = "Utf82unicode" (Iconv ($language, "UTF-8", $v)). ";";
}else {
$str. = $v;
}
}
return $str;
}
function Utf82unicode ($c) {
Switch (strlen ($c)) {
Case 1:
Return ord ($c);
Case 2:
$n = (ord ($c [0]) & 0x3f) << 6;
$n + = Ord ($c [1]) & 0x3f;
return $n;
Case 3:
$n = (ord ($c [0]) & 0x1f) << 12;
$n + = (ord ($c [1]) & 0x3f) << 6;
$n + = Ord ($c [2]) & 0x3f;
return $n;
Case 4:
$n = (ord ($c [0]) & 0x0f) << 18;
$n + = (ord ($c [1]) & 0x3f) << 12;
$n + = (ord ($c [2]) & 0x3f) << 6;
$n + = Ord ($c [3]) & 0x3f;
return $n;
}
}
http://www.bkjia.com/PHPjc/318279.html www.bkjia.com true http://www.bkjia.com/PHPjc/318279.html techarticle very bitter and boring to discover that the HKSCS problem that has always been troubling PHP has been supported. Only the name is not called Hk-scs, called Big5-hkscs. The following is the solution for the HK supplemental Character set: HTML page ...