GB码到UTF码,但服务器不支持iconv()怎么办? `echo "$tmp"|iconv -f GBK -t UTF8`; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 google把,很多gb转utf8的程序,用的是码表 test/* gb转utf8 */function gb2utf8($gb){ static $gb2utf8codetable ; if ( function_exists('iconv') ) { return $message = iconv("gb2312", "UTF-8", $gb) ; } if ( ! $gb2utf8codetable ) { $codetablefile = file("gb2utf8",1); $gb2utf8codetable=array(); while(list($key,$value)=each($codetablefile)) $gb2utf8codetable[substr($value,0,2)]=substr($value,5,substr($value,3,1)); } for($utf8=""; $gb!=''; ) { if (ord(substr($gb,0,1))>127) { $utf8.=$gb2utf8codetable[substr($gb,0,2)]; $gb=substr($gb,2); } else { $utf8.=substr($gb,0,1); $gb=substr($gb,1); } } return $utf8;}/* utf8转gb */function utf82gb($utf8){ static $utf82gbcodetable ; if ( function_exists('iconv') ) return $message = iconv("UTF-8", "gb2312" ,$utf8) ; if ( ! $utf82gbcodetable ) { $codetablefile = file("gb2utf8",1); $utf82gbcodetable=array(); while(list($key,$value)=each($codetablefile)) $utf82gbcodetable[substr($value,5,substr($value,3,1))]=substr($value,0,2); } for($gb=""; $utf8!=''; ) { if (ord(substr($utf8,0,1))>224) { # 三字节 $gb .= $utf82gbcodetable[substr($utf8,0,3)]; $utf8=substr($utf8,3); } elseif ( ord(substr($utf8,0,1))>127 ) { $gb .= $utf82gbcodetable[substr($utf8,0,2)]; $utf8=substr($utf8,2); } else { $gb.=substr($utf8,0,1); $utf8=substr($utf8,1); } } return $gb;} 可以下载一个点阵字体以前ucdos自带那种 addJavaScript()问题 现在用FCK出现的问题,请帮忙(急!!) 请大家帮忙看看。急!! 做类似于这个站,大概需要多少钱?或者以技术入股的形式加入我们? 天啦,终于升到3个三角了,不知道何年何月才会有一颗星,散分了。 请教: getenv()的疑问 怪事啦! 为什么上传, 上传gif就可以, 上传txt就不行? 在网上下载了一个php原码美国网页 数据库用的sybase mysql查询 数据不满足SQL条件 显示出来了 关于session 的问题 初学者 请教 mysql有这样的统计方法吗?在线等.
function gb2utf8($gb)
{
static $gb2utf8codetable ; if ( function_exists('iconv') ) {
return $message = iconv("gb2312", "UTF-8", $gb) ;
}
if ( ! $gb2utf8codetable ) {
$codetablefile = file("gb2utf8",1);
$gb2utf8codetable=array();
while(list($key,$value)=each($codetablefile))
$gb2utf8codetable[substr($value,0,2)]=substr($value,5,substr($value,3,1));
}
for($utf8=""; $gb!=''; )
{
if (ord(substr($gb,0,1))>127) {
$utf8.=$gb2utf8codetable[substr($gb,0,2)];
$gb=substr($gb,2);
} else {
$utf8.=substr($gb,0,1);
$gb=substr($gb,1);
}
}
return $utf8;
}/* utf8转gb */
function utf82gb($utf8)
{
static $utf82gbcodetable ; if ( function_exists('iconv') )
return $message = iconv("UTF-8", "gb2312" ,$utf8) ; if ( ! $utf82gbcodetable ) {
$codetablefile = file("gb2utf8",1);
$utf82gbcodetable=array();
while(list($key,$value)=each($codetablefile))
$utf82gbcodetable[substr($value,5,substr($value,3,1))]=substr($value,0,2);
} for($gb=""; $utf8!=''; )
{
if (ord(substr($utf8,0,1))>224) { # 三字节
$gb .= $utf82gbcodetable[substr($utf8,0,3)];
$utf8=substr($utf8,3);
} elseif ( ord(substr($utf8,0,1))>127 ) {
$gb .= $utf82gbcodetable[substr($utf8,0,2)];
$utf8=substr($utf8,2);
} else {
$gb.=substr($utf8,0,1);
$utf8=substr($utf8,1);
}
} return $gb;
}
以前ucdos自带那种