亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1261 | 回復(fù): 4
打印 上一主題 下一主題

繁體中文轉(zhuǎn)換為簡體中文的PHP函數(shù) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2005-01-13 13:12 |只看該作者 |倒序?yàn)g覽
我在一網(wǎng)站上看到該函數(shù)
但找不到 data_big5.php 文件下載
不知這里有沒有人有,給我了一份
謝了!

jumpbull@sina.com

論壇徽章:
0
2 [報告]
發(fā)表于 2005-01-13 13:12 |只看該作者

繁體中文轉(zhuǎn)換為簡體中文的PHP函數(shù)

隨便附一下這個函數(shù)

<?
/***********************************************************************
Written by caocao
caocao@eastday.com
http://caocao.oso.com.cn

With the help of Keyes
Keyes2000@263.net
http://my-wjl.scu.edu.cn/~Keyes
***********************************************************************/
function isbig5($code)
{
if (strlen($code)>;=2)
{
$code=strtok($code,"";

if (ord($code[0]) < 161)
{
return (0);
}
else
{
if (((ord($code[1]) >;= 64)&&(ord($code[1]) <= 126))||((ord($code[1]) >;= 161)&&(ord($code[1]) <= 254)))
{
return (1);
}
else
{
return (0);
}
}
}
else
{
return (0);
}
}

function big5offset($code)
{
if (strlen($code) >;= 2)
{
$code=strtok($code,"";
if ((ord($code[1]) >;= 64)&&(ord($code[1]) <= 126))
{
return ((ord($code[0]) - 161) * 157 + (ord($code[1]) - 64));
}
if ((ord($code[1]) >;= 161)&&(ord($code[1]) <= 254))
{
return ((ord($code[0]) - 161) * 157 + 63 + (ord($code[1]) - 161));
}
}
return (-1);
}

function wordtostring($code)
{
return (chr(hexdec(substr($code,0,2))).chr(hexdec(substr($code,2,2))));
}

function big5togb($code)
{
include "data_big5.php";
$output="";
$length=strlen($code);
$code=strtok($code,"";
$idx=0;
while ($idx < $length)
{
$tmpStr=$code[$idx].$code[$idx+1];

if (isbig5($tmpStr))
{
$offset=big5offset($tmpStr);
if (($offset >;= 0)||($offset <= 14757))
{
$output.=wordtostring($big5order[$offset]);
$idx++;
}
else
{
$output.= $code[$idx];
}
}
else
{
$output.= $code[$idx];
}
$idx++;
}
return ($output);
}
?>;

論壇徽章:
0
3 [報告]
發(fā)表于 2005-01-19 16:15 |只看該作者

繁體中文轉(zhuǎn)換為簡體中文的PHP函數(shù)

這個程序本身就可以使用呀,把include注釋就行了。

論壇徽章:
0
4 [報告]
發(fā)表于 2005-01-19 16:22 |只看該作者

繁體中文轉(zhuǎn)換為簡體中文的PHP函數(shù)

$轉(zhuǎn)換后的GB字符串 = big5togb($轉(zhuǎn)換前的BIG5字符串);

這樣就可以。

論壇徽章:
1
榮譽(yù)版主
日期:2011-11-23 16:44:17
5 [報告]
發(fā)表于 2005-01-19 17:35 |只看該作者

繁體中文轉(zhuǎn)換為簡體中文的PHP函數(shù)

還是用這個比較合適
iconv Functions

This module contains an interface to iconv character set conversion facility. With this module, you can turn a string represented by a local character set into the one represented by another character set, which may be the Unicode character set. Supported character sets depend on the iconv implementation of your system. Note that the iconv function on some systems may not work as you expect. In such case, it'd be a good idea to install the GNU libiconv library. It will most likely end up with more consistent results.
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP