Home > php教程 > PHP源码 > php gb2312转big5 函数

php gb2312转big5 函数

PHP中文网
Release: 2016-05-25 17:09:39
Original
1209 people have browsed it

[PHP]代码 

function GB2312toBIG5($c) {
$f = fopen(CODETABLE_DIR.$this->config['GBtoBIG5_table'], ‘r’);
$max=strlen($c)-1;
for($i = 0;$i < $max;$i++){ $h=ord($c[$i]); if($h>=160) {
$l=ord($c[$i+1]);
if($h==161 && $l==64){
$gb=” “;
} else{
fseek($f,($h-160)*510+($l-1)*2);
$gb=fread($f,2);
}
$c[$i]=$gb[0];
$c[$i+1]=$gb[1];
$i++;
}
}
$result = $c;
return $result;
}
Copy after login

                   

                   

Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template