紧急问题:有哪位大虾有GBK码转GB2312/big5码的算法或经验,最好有例程,急!急!急!!!! (100分)

我有一个GB<->Big5的源代码pas,让我找找.
 
http://coldease.myetang.com/source/booksour.zip
有许多好代码
 
只要有对照表就好办,但我没有。转换时不要用memo,要在内存中处理转换,这样至少要
快上5倍。
 
如果可以自己编程实现智能加入汉字,就解决啦!
是不是等于没有说啊!
呵呵!
我也不懂!我想能和智能陈桥五笔的方式处理做的一样就应该能解决啦!
 
是为单位开发的,主要是直接处理一些姓名,因为多数数据是繁体EXCEL里导出的文本,
是用DELPHI5开发的单机程序,现在用码表在MEMO中一个个替换,超过1000条记录实在。。。
 
不好意思,
我也不懂!
 
呵,我也不懂,学习中。
 
给我你的电子邮件
akuo_462222@hotmail.com
 
先用别的软件把这个TXT文件转为GB2313的格式,再读取。
如: text robot
 
http://kiven.yeah.net 电子书库 gbbig.pas
 
unit gb2big5;
interface
function GBtoBIG5(value: string): string;
function BIG5toGB(value: string): string;
implementation
var BIG5Order : array[0..14757] of Word;
GBOrder : array[0..8177] of Word;
function GBOffset(value: string): integer;
begin
if length(value)>=2 then
Result:=(Ord(value[1])-161)*94+(Ord(value[2])-161)
else
Result:=-1;
end;

function BIG5Offset(value: string): integer;
begin
if length(value)>=2 then
begin
if (Ord(value[2])>=64) and (Ord(value[2])<=126) then
Result:=(Ord(value[1])-161)*157+(Ord(value[2])-64);
if (Ord(value[2])>=161) and (Ord(value[2])<=254) then
Result:=(Ord(value[1])-161)*157+63+(Ord(value[2])-161);
end
else
Result:=-1;
end;

function WordToString(value: Word): string;
begin
Result:=Chr(Hi(value))+Chr(Lo(Value));
end;

function isBIG5(value: string): Boolean;
begin
if (length(value)>=2) then
begin
if (value[1]<#161) then
Result:=false
else
if ((value[2]>=#64) and (value[2]<=#126)) or ((value[2]>=#161) and (value[2]<=#254)) then
Result:=true
else
Result:=false;
end
else
Result:=false;
end;

function isGB(value: string): Boolean;
begin
if (length(value)>=2) then
begin
if (value[1]<=#161) and (value[1]>=#247) then
Result:=false
else
if (value[2]<=#161) and (value[2]>=#254) then
Result:= false
else
Result:=true;
end
else
Result:=true;
end;

function GBtoBIG5(value: string): string;
var leng, idx : integer;
tmpStr : string[2];
Offset : integer;
output : string;
begin
output:='';
leng:=length(value);
idx:=1;
while idx<=lengdo
begin
tmpStr:=value[idx]+value[idx+1];
if isGB(tmpStr) then
begin
offset:=GBOffset(tmpStr);
if (offset>=0) and (offset<=8177) then
begin
output:=output+WordToString(GBOrder[offset]);
inc(idx);
end
else
output:=output+value[idx] ;
end
else
output:=output+value[idx] ;
inc(idx,1);
end;
Result:=output;
end;

function BIG5toGB(value: string): string;
var leng,idx : integer;
tmpStr : string[2];
output : string;
offset : integer;
begin
output:='';
leng:=length(value);
idx:=1;
while idx<=lengdo
begin
tmpStr:=value[idx]+value[idx+1];
if isBIG5(tmpStr) then
begin
offset:=BIG5Offset(tmpStr);
if (offset>=0) and (offset<=14757) then
begin
output:=output+WordToString(BIG5Order[offset]);
inc(idx);
end
else
output:=output+value[idx];
end
else
output:=output+value[idx];
inc(idx);
end;
Result:=output;
end;
 
Too much!!!
 
[blue][/blue]全是废话!没有 一个敢说自己是老大的,你们为什么不去看看我的问题,我问了一年了!没有
人回答真让我感觉到这里的技术是不是已经过时了,或者是这是这里的人已经不
是做编程的!
http://www.delphibbs.com/delphibbs/dispq.asp?lid=719446
http://www.delphibbs.com/delphibbs/dispq.asp?lid=666070
http://www.delphibbs.com/delphibbs/dispq.asp?lid=716037
http://www.delphibbs.com/delphibbs/dispq.asp?lid=730641
http://www.delphibbs.com/delphibbs/dispq.asp?lid=655233
如果能有人回答这些问题才是真的高手呀!
 
今天用了wangxd的方法,转换时不要用memo,要在内存中处理转换,确實快了很多。

 
现在在MEMO中的码表如下:
編编碼码偉伟劉刘飛飞賢贤學学華华鳳凤許许剛刚謝谢鋒锋紅红張张馮冯軍军衛卫東东
長长濤涛趙赵羅罗義义葉叶國国陳陈楊杨鄭郑頂顶細细蘭兰孫孙賀贺鍾钟艷艳瑩莹純纯
運运紅红強强麗丽風风
 
有哪们用过“内码转换一点通”,他的“繁本->简体”,“简体->繁本”,即是我想要的,
但不知道怎样做出来的,速度很快的。
http://www8.pconline.com.cn/download/swdetail.phtml?id=7991
主要功能如下:
1. 文件的转换功能全都集成在资源管理器的右键菜单中。
2. 除支持国标、大五码的转换外还提供繁、简汉字之间的转换。
3. 操作简单,只须鼠标一框,轻点两下,转换工作便告完成。
4. 支持对多个文件、目录的集体转换,还可设置要转换的目录的深度。
5. 具备侦测文件内码功能,避免了对文件的重复转换超成乱码。
 
关注,我也只有gb<->big的。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
817
SUNSTONE的Delphi笔记
S
I
回复
0
查看
810
import
I
I
回复
0
查看
864
import
I
顶部