About Big5-hkscs Solutions _php Tutorials

Source: Internet
Author: User
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 ...

  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.