PHP does not use the iconv () function GBK to go to unicode (utf8)

time:10-07-16 forum:PHP tools and code
  Reloaded from http://bbs.blueidea.com/thread-597824-1-1.html

Download qswhGBK file first, [url:34009v2u]http://www.blueidea.com/user/qswh/qswhGBK.zip[/url:34009v2u]
[url:34009v2u]http://www.11jn.com/qswhGBK.zip[/url:34009v2u]
[url:34009v2u]http://www.11jn.com/qswhGBK.zip[/url:34009v2u]
color=#FF0000] download, unzip qswhGBK.ra The R file gets the qswhGBK.php file and is placed in the same directory with your PHP program files. [/color]
[code].lt;?
class qswhGBK{
var $qswhData;
function qswhGBK ($filename=.quot; qswhGBK.php.quot; >). R / > for ($i=0; $i.lt; strlen ($gb); $i) {
if ($p=ord (substr ($gb, 1)); 127) (allback))
$ret.=$q;
else {
$arr=array (.Quot; htmlHex.quot;.Quot; htmlDec.quot;.Quot;.Quot); .#93; ($q);
}else
$ret.=$callback ($q);
}
}
return $ret;
>; }


function escape ($str) {
return hexdec ($str).Lt; 256? Uot;
$dec=hexdec ($str);
$bin=decbin ($dec);
$len=strlen ($bin);
$arr=array. Dechex (0x80 bindec (substr ($bin, $i-6,6)).$ret;
else
$ret=.quot;%.quot;.Dechex / > > >; < Br / >}
return $ret;
}
}[/code]

use example
[code]
.lt; (.Quot;.Lt; xmp.gt; without parameters:.Quot;.$qswh-.gt; gb2u ($words));
echo (.Quot; \n called built-in function htmlHex:.quot); />echo (.Quot; \n calls the built-in function u2utf8:.quot;.$qswh-.gt; gb2u ($words, 4));
echo (.Quot; \n calls a custom function:.Quot; >?
  • 2

prev:PHP does not use iconv () function UTF8 ... next:The easiest thing for pregnant women is ...
post comment
Notice



approved   The age of mortgage repayment is rai...   What do you do with a baby crying ou...   39 years old as a girl! Takizawa Mak...   Have you ever eaten steamed pagoda f...   93 year old math professor returns t...
rand   Using regular expressions to verify ...   Regular string replacement and parti...   PHP determines the character functio...      Cross domain call COOKIES
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