|
|
本帖最后由 jackyshow 于 2010-9-16 01:27 编辑
谁知道这是啥编码???
& # x 7 F 5 1 ; (网)---中间没空格,直接发布的话浏览器会直接转换 看不到
w(w)
括号里是对应的字符,其实就是51la的关键词编码,搞了半天没搞清楚什么编码。。。想抓取。。以下是插件函数,貌似不起作用-
- function str_from_unicode($str, $out_charset = 'gbk'){
- $str = preg_replace_callback("|&#([0-9]{1,5});|", 'unicode2utf8_', $str);
- $str = iconv("UTF-8", $out_charset, $str);
- return $str;
- }
- function unicode2utf8_($c){
- return unicode2utf8($c[1]);
- }
- function unicode2utf8($c){
- $str="";
- if ($c < 0x80) {
- $str.=$c;
- } else if ($c < 0x800) {
- $str.=chr(0xC0 | $c>>6);
- $str.=chr(0x80 | $c & 0x3F);
- } else if ($c < 0x10000) {
- $str.=chr(0xE0 | $c>>12);
- $str.=chr(0x80 | $c>>6 & 0x3F);
- $str.=chr(0x80 | $c & 0x3F);
- } else if ($c < 0x200000) {
- $str.=chr(0xF0 | $c>>18);
- $str.=chr(0x80 | $c>>12 & 0x3F);
- $str.=chr(0x80 | $c>>6 & 0x3F);
- $str.=chr(0x80 | $c & 0x3F);
- }
- return $str;
- }
复制代码 |
|