免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3819 | 回复: 5
打印 上一主题 下一主题

小弟写了个php程序:把你的GB网页转为BIG5网页! [复制链接]

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2002-02-27 13:58 |只看该作者 |倒序浏览
<font size=4>;<b>;Make your GB file to Big5 file</b>;</font>;   
<font size=2>owered 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!=&quot;&quot
{
///////////////
//----------------
$mb_file=&quot;hc.tab&quot;;
$d_big5_er=&quot;^&quot;;
$gb_file=$srcfile;
$big5_file=time().&quot;big5_file&quot;;
//----------------
if(!fopen($gb_file,&quot;r&quot){echo&quot;<br>;<br>;<font color=red size=4>;The $gb_file file is not ready!</font>;&quot;;exit;}
if(!fopen($mb_file,&quot;r&quot){echo&quot;<br>;<br>;<font color=red size=4>;The $mb_file file is not ready!</font>;&quot;;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,&quot;w+&quot;
fwrite($fp,$big5_src);
//--------------
echo&quot;<br>;<br>;Complete!  <a href=$big5_file>;Visit the big5 file now!</a>;&quot;;
////////////////
}
?>;

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2002-02-27 14:00 |只看该作者

小弟写了个php程序:把你的GB网页转为BIG5网页!

请大虾们指正

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
3 [报告]
发表于 2002-02-27 14:09 |只看该作者

小弟写了个php程序:把你的GB网页转为BIG5网页!

还差点忘记了,
本程序在:http://gsp.8800.org/temp/hh/gb2big5.php
hc.tab简繁对照表在:http://gsp.8800.org/temp/hh/hc.tab

论坛徽章:
0
4 [报告]
发表于 2002-12-05 00:54 |只看该作者

小弟写了个php程序:把你的GB网页转为BIG5网页!

做得好!基本上OK
最好顺便meta标签也变一下
<META http-equiv=Content-Type content=&quot;text/html&#59; charset=gb2312&quot;>;
变成
<META http-equiv=Content-Type content=&quot;text/html&#59; charset=big5&quot;>;
不然用简体中文浏览器看会乱码
但是有很多“^”
恐怖的对照表,这也是自己做的吗?

论坛徽章:
0
5 [报告]
发表于 2002-12-05 09:40 |只看该作者

小弟写了个php程序:把你的GB网页转为BIG5网页!

尚可,还有待改进。

论坛徽章:
0
6 [报告]
发表于 2003-09-13 16:47 |只看该作者

小弟写了个php程序:把你的GB网页转为BIG5网页!

总体来说,写的还是可以的。只是有一点乱。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP