编码
/**
* 当制作好编码对照表后,并不能马上使用还需对其进行一些加工
* 当然简单的查表是可以的但效率不高
* 现在以繁简转换为例,说明对照表的使用
*/
/**
* 连接并打开对照表
*/
$conn = mysql_connect();
mysql_select_db("unicode");
/**
* 提取其中big5和gbk编码,表中big5只有13487个(包括符号)
*/
$sql = "select gbk,big5,gb2312 from unicode where big5 != ''";
//$sql = "select * from unicode";
$rs = mysql_query($sql);
echo mysql_num_rows($rs)."
";
/**
* 读取数据到数组,注意key和value的处理
*/
$code = array(0=>"gb",big5=>0);
while($row = mysql_fetch_array($rs)) {
$code[pack("H4",$row][gbk])] = pack("H4",$row[big5]);
// $code[$row][gb2312]] = pack("H4",$row[big5]);
}
mysql_close($conn);
function gb_big5($s) {
global $code;
$v = "";
if($code[0] == "big5")
$code = $arr_flip($code);
for($i=0;$i
$p = sprintf("%02X%02X",$s[$i],$s[$i+1]);
$p = $s[$i].$s[$i+1];
$ch = $code[$p];
if($ch == "")
$ch = $s[$i].$s[$i+1];
$v .= $ch;
$i++;
}else
$v .= $s[$i];
}
return $v;
}
echo '';
echo gb_big5('

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)