There is a limited version of the functionality on NT-based platforms, in the LCMapStringW API (note that the LCMapStringA API should not be used here, for hopefully obvious reasons <grin>). But the work done in Microsoft Word 2000 and later is much more functional as it is dictionary based and covers a wider range of ideographs. BTW, the API function can not be relied on - there is no general one-to-one mapping from traditional to simplified chinese characters. This is particularly true going from simplified to traditional where there might be any number of traditional characters that correspond to a single simplified character - that is the nature of the way the PRC simplification was done. As a consequence you need to use dictionary-based conversion to be sure to get it right most of the time - even then there could be errors without manual checking. A comprehensive SC-TC dictionary should include millions of terms.See also http://www.basistech.com/knowledge%2Dcenter/#chinese http://www.cjk.org/cjk/reference/chinvar.htm Orthographic Variation in Chinese - Jack Halpern, The CJK Dictionary Institute, Inc., good explanation of the challenge http://www.cjk.org/cjk/c2c/c2cbasis.htm The Pitfalls and Complexities of Chinese to Chinese Conversion] http://www.mandarintools.com/faq.html Mandarintools.com - FAQ on Chinese on computers http://zh.wikipedia.org/wiki/Help:%E4%B8%AD%E6%96%87%E7%BB%B4%E5%9F%BA%E7%99%BE%E7%A7%91%E7%9A%84%E7%B9%81%E7%AE%80%E5%A4%84%E7%90%86 Help:中文维基百科的繁简处理
function Big52GB(BIG5Str : String): AnsiString; {进行big5转GB内码} var Len: Integer; pBIG5Char: PChar; pGBCHSChar: PChar; pGBCHTChar: PChar; pUniCodeChar: PWideChar; begin //String -> PChar pBIG5Char := PChar(BIG5Str); Len := MultiByteToWideChar(950,0,pBIG5Char,-1,nil,0); GetMem(pUniCodeChar,Len*2); ZeroMemory(pUniCodeChar,Len*2); //Big5 -> UniCode MultiByteToWideChar(950,0,pBIG5Char,-1,pUniCodeChar,Len); Len := WideCharToMultiByte(936,0,pUniCodeChar,-1,nil,0,nil,nil); GetMem(pGBCHTChar,Len*2); GetMem(pGBCHSChar,Len*2); ZeroMemory(pGBCHTChar,Len*2); ZeroMemory(pGBCHSChar,Len*2); //UniCode->GB CHT WideCharToMultiByte(936,0,pUniCodeChar,-1,pGBCHTChar,Len,nil,nil); //GB CHT -> GB CHS LCMapString($804,LCMAP_SIMPLIFIED_CHINESE,pGBCHTChar,-1,pGBCHSChar,Len); Result := String(pGBCHSChar); FreeMem(pGBCHTChar); FreeMem(pGBCHSChar); FreeMem(pUniCodeChar); end;
http://community.csdn.net/Expert/topic/4704/4704819.xml?temp=.9637873
http://www.basistech.com/knowledge%2Dcenter/#chinese
http://www.cjk.org/cjk/reference/chinvar.htm Orthographic Variation in Chinese - Jack Halpern, The CJK Dictionary Institute, Inc., good explanation of the challenge
http://www.cjk.org/cjk/c2c/c2cbasis.htm The Pitfalls and Complexities of Chinese to Chinese Conversion]
http://www.mandarintools.com/faq.html Mandarintools.com - FAQ on Chinese on computers
http://zh.wikipedia.org/wiki/Help:%E4%B8%AD%E6%96%87%E7%BB%B4%E5%9F%BA%E7%99%BE%E7%A7%91%E7%9A%84%E7%B9%81%E7%AE%80%E5%A4%84%E7%90%86 Help:中文维基百科的繁简处理
{进行big5转GB内码}
var
Len: Integer;
pBIG5Char: PChar;
pGBCHSChar: PChar;
pGBCHTChar: PChar;
pUniCodeChar: PWideChar;
begin
//String -> PChar
pBIG5Char := PChar(BIG5Str);
Len := MultiByteToWideChar(950,0,pBIG5Char,-1,nil,0);
GetMem(pUniCodeChar,Len*2);
ZeroMemory(pUniCodeChar,Len*2);
//Big5 -> UniCode
MultiByteToWideChar(950,0,pBIG5Char,-1,pUniCodeChar,Len);
Len := WideCharToMultiByte(936,0,pUniCodeChar,-1,nil,0,nil,nil);
GetMem(pGBCHTChar,Len*2);
GetMem(pGBCHSChar,Len*2);
ZeroMemory(pGBCHTChar,Len*2);
ZeroMemory(pGBCHSChar,Len*2);
//UniCode->GB CHT
WideCharToMultiByte(936,0,pUniCodeChar,-1,pGBCHTChar,Len,nil,nil);
//GB CHT -> GB CHS
LCMapString($804,LCMAP_SIMPLIFIED_CHINESE,pGBCHTChar,-1,pGBCHSChar,Len);
Result := String(pGBCHSChar);
FreeMem(pGBCHTChar);
FreeMem(pGBCHSChar);
FreeMem(pUniCodeChar);
end;