Home > Back-end > Delphi XE5 Base64 decoding Big5 string met some garbled.
Delphi XE5 Base64 decoding Big5 string met some garbled.
Time:09-26
Test string: p9o/p9quYQ== Correct analytic results: I love my family Test result: me? My family (lost love words) The test code: //USES Soap. EncdDecd The function DecodeBase64Str2: string; Var InStr, OutStr: TStringStream; The begin InStr:=TStringStream. Create (' p9o/p9quYQ=='); InStr. SaveToFile (' c: \ 1. TXT);//output results: p9o/p9quYQ==right Try OutStr:=TStringStream. Create ("); Try DecodeStream (InStr, OutStr); OutStr. SaveToFile (' c: \ 2. TXT); //output results: и? и is produced, the right should be и 稲 и production //software will be the third aspects according to Big5 code character to check for me? My family //at this time have been lost, "love" word Result:=TEncoding GetEncoding (950). Get string (OutStr. Bytes);//the Big5 code into gb2312 //the Result:='me? My home ' The finally OutStr. Free; end; The finally InStr. Free; end; end;