S
samy_ywj
Unregistered / Unconfirmed
GUEST, unregistred user!
function BIG5_GB(Value: string): string;<br>var<br> Len: Integer;<br> p, p1, p2: PChar;<br> ws: LPWSTR; <br>begin <br> p := PChar(Value);<br> Len := MultiByteToWideChar(950, 0, p, -1, nil, 0);<br> ws := AllocMem(Len + 1);<br> MultiByteToWideChar(950, 0, p, -1, ws, Len);<br> Len := WideCharToMultiByte(936, 0, ws, -1, nil, 0, nil, nil);<br> p1 := AllocMem(Len + 1);<br> p2 := AllocMem(Len + 1);<br> WideCharToMultiByte(936, 0, ws, -1, p1, Len, nil, nil);<br> LCMapString($0804, LCMAP_SIMPLIFIED_CHINESE, p1, -1, p2, Len);<br> Result := string(p2);<br> FreeMem(ws);<br> FreeMem(p1);<br> FreeMem(p2);<br>end;<br><br>function GB_BIG5(Value: string; bFull: Boolean): string;<br>var<br> Len: Integer;<br> p, p1, p2: PChar;<br> ws: LPWSTR;<br>begin<br> Result := '';<br> p := PChar(Value);<br> Len := MultiByteToWideChar(936, 0, p, -1, nil, 0);<br> p1 := AllocMem(Len * 2 + 1);<br> LCMapString($0804, LCMAP_TRADITIONAL_CHINESE, p, -1, p1, Len * 2);<br> if bFull then<br> begin<br> ws := AllocMem(Len + 1);<br> MultiByteToWideChar(936, 0, p1, -1, ws, Len);<br> Len := WideCharToMultiByte(950, 0, ws, -1, nil, 0, nil, nil);<br> p2 := AllocMem(Len + 1);<br> WideCharToMultiByte(950, 0, ws, -1, p2, Len, nil, nil);<br> Result := string(p2);<br> FreeMem(p2);<br> FreeMem(ws);<br> end<br> else<br> Result := string(p1);<br> FreeMem(p1);<br>end;