function BIG5ToGB2312(GBStr: string): AnsiString;
{进行GBK繁体转简体}
var
Len: integer;
pGBCHTChar: PChar;
pGBCHSChar: PChar;
begin
pGBCHTChar := PChar(GBStr);
Len := MultiByteToWideChar(936, 0, pGBCHTChar, -1, nil, 0);
GetMem(pGBCHSChar, Len * 2 + 1);
ZeroMemory(pGBCHSChar, Len * 2 + 1);
//GB CHS -> GB CHT
LCMapString($804, LCMAP_SIMPLIFIED_CHINESE, pGBCHTChar, -1, pGBCHSChar, Len * 2);
result := string(pGBCHSChar);
//FreeMem(pGBCHTChar);
FreeMem(pGBCHSChar);
end;
function GB2312ToBIG5(GB2312Str: string): AnsiString;
var
iLen: Integer;
PGBCHSStr: PChar; //GB编码的简体字符
PGBCHTStr: PChar; //GB编码的繁体字符
PUnicodeChar: PWideChar; //Unicode编码的字符
PBIG5Str: PChar; //BIG5编码的字符
begin
PGBCHSStr:=PChar(GB2312Str);
iLen:=MultiByteToWideChar(936,0,PGBCHSStr,-1,nil,0); //计算转换的字符数
GetMem(PGBCHTStr,iLen*2+1); //分配内存
LCMapString($0804,LCMAP_TRADITIONAL_CHINESE,PGBCHSStr,-1,PGBCHTStr,iLen*2); //转换GB码简体到GB码繁体
GetMem(PUnicodeChar,iLen*2); //分配内存
MultiByteToWideChar(936,0,PGBCHTStr,-1,PUnicodeChar,iLen); //转换GB码到Unicode码
iLen:=WideCharToMultiByte(950,0,PUnicodeChar,-1,nil,0,nil,nil);
GetMem(PBIG5Str,iLen);
WideCharToMultiByte(950,0,PUnicodeChar,-1,PBIG5Str,iLen,nil,nil);
// Result:=string(PBIG5Str);
Result:=string(PGBCHTStr);
FreeMem(PBIG5Str);
FreeMem(PUnicodeChar);
FreeMem(PGBCHTStr);
end;