小弟写了个php程序:把你的GB网页转为BIG5网页!
fontsize=4bMakeyourGBfiletoBig5file/b/font fontsize=2Poweredbyzyme.Welcometowww.ipisu.com./fontbrbr formaction='?$php_self;?'method=post TheGBfile:inputname='srcfile' inputtype=submitvalue='Make!' /form ?php//Poweredbyzyme//Welcometowww.ip
<font size=4><b>Make your GB file to Big5 file</b></font>
<font size=2>Powered by zyme. Welcome to www.ipisu.com.</font><br><br>
<form action='<?$php_self;?>' method=post>
The GB file:<input name='srcfile'>
<input type=submit value='Make!'>
</form>
<?php //Powered by zyme //Welcome to www.ipisu.com
if($srcfile!=""
{
///////////////
//----------------
$mb_file="hc.tab";
$d_big5_er="^";
$gb_file=$srcfile;
$big5_file=time()."big5_file";
//----------------
if(!fopen($gb_file,"r"
){echo"<br><br><font color=red size=4>The $gb_file file is not ready!</font>";exit;}
if(!fopen($mb_file,"r"
){echo"<br><br><font color=red size=4>The $mb_file file is not ready!</font>";exit;}
$mb_fl=file($mb_file);
$gb_fl=file($gb_file);
for($a=0;$gb_fl[$a];$a++)
{
$gb_l_len=strlen($gb_fl[$a]);
for($b=0;$b<=$gb_l_len;$b++)
{
$o_w=substr($gb_fl[$a],$b,1);
if(ord($o_w)>12
{
$o_w=substr($gb_fl[$a],$b,2);
for($c=0;$mb_fl[$c];$c++)
{
if($o_w==substr($mb_fl[$c],0,2))
{
$n_w=substr($mb_fl[$c],2,-1);
if(strlen($n_w)>2)
{
$n_w=$d_big5_er.$n_w.$d_big5_er;
}
break;
}
else if(!$mb_fl[$c+1])
{
$n_w=$o_w;
}
}
$b++;
}
else
{
$n_w=$o_w;
}
$big5_fl[$a]=$big5_fl[$a].$n_w;
}
$big5_src=$big5_src.$big5_fl[$a];
}
//--------------
$fp=fopen($big5_file,"w+"
;
fwrite($fp,$big5_src);
//--------------
echo"<br><br>Complete! <a href=$big5_file>Visit the big5 file now!</a>";
////////////////
}
?>
zyme 回复于:2002-02-27 14:00:04
|
请大虾们指正
|
zyme 回复于:2002-02-27 14:09:02
|
还差点忘记了, 本程序在:http://gsp.8800.org/temp/hh/gb2big5.php hc.tab简繁对照表在:http://gsp.8800.org/temp/hh/hc.tab
|
reficul 回复于:2002-12-05 00:54:25
|
做得好!基本上OK 最好顺便meta标签也变一下 <META http-equiv=Content-Type content="text/html; charset=gb2312"> 变成 <META http-equiv=Content-Type content="text/html; charset=big5"> 不然用简体中文浏览器看会乱码 但是有很多“^” 恐怖的对照表,这也是自己做的吗?
|
redfox 回复于:2002-12-05 09:40:03
|
尚可,还有待改进。
|
East3gold 回复于:2003-09-13 16:47:26
|
总体来说,写的还是可以的。只是有一点乱。
|
原文转自:http://www.ltesting.net
|