非常苦??地??,原?硪恢崩?_的HKSCS???PHP一直也支持。只不?名?不叫HK-SCS,叫BIG5-HKSCS。
以下是HK增?字符集的解?Q方案:
HTML?面???TF-8,
??入???烨跋龋?conv('big5-hkscs','utf8', $string)
需???NICODE就用以下函?
function String2Unicode($data, $language)
{
$data = nl2br(trim($data));
$data = str_replace('<br />',chr(13),$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;
}
}
关于BIG5-HKSCS的解决方法
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@