Conversion of GB2312 and Unicode code in PHP

time:10-07-15 forum:PHP tools and code
  Reprinted from http://dodomail.javaeye.com/blog/195361

[code].lt; PHP
/ / / / / / / utf8 ---.gt; Unicode
function utf8_unicode ($c); $n = ord ($c.#91; 1.#93;).Amp; 0x3f;
return $n;
case 3:. / > $n = (ord ($c.#91; 0.#93;).Amp; 0x0f).Lt;.Lt;
$n = (ord ($c.#91; >) Unicode
function gb2un ($g) / / / / / / / > GB2312 string
{
preg_match_all (.Quot; /.#91); Quot; utf-8.quot; $v)..quot;.Quot;

return $str;

foreach ($ar as $k=.gt; $v) {
if. Uot; ucs-2.quot;.Quot; gb2312.quot; pack (.Quot; h4.quot; substr ($v, -1)); }
}
return join (.Quot;.Quot; $ar);
}

//unicode converts to GB2312 / > > > > >} / >

prev:PHP uses iconv () function to solve UNIC... next:PHP does not use iconv () function UTF8 ...
post comment
Notice



approved   The "one school one product" sports ...   These "90" in the mountains, the vil...   Chinese girls spend 4 years designin...   Chongqing version of "peach sister":...   Returnees in mountainous areas suppo...
rand   PHP decryption of Unicode coded char...   PHP to get the breakpoint renewal co...   How to optimize Mysql tens of millio...   Formal release of PHP 5.3.6   Generating HTML static pages with PH...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com