function Ucs2ToGBK(const InValue: string): string; var I: Integer; begin Result := ''''''''; for I := 1 to length(InValue) div 2 - 1 do Result := Result + WideChar(StrToInt(''''$'''' + IntToHex(Ord(InValue[2 * I - 1]), 2) + IntToHex(Ord(InValue[2 * I]), 2))); end;