Home > Back-end >  Decoding problems: Delphi function default "decoding way?"
Decoding problems: Delphi function default "decoding way?"

Time:02-04

Environment: delphi2010

Mission: utf-8? Q, iso - 2022 - jp? B, iso - 2022 - jp? The decoding
Q, and so on and so forth
Case description:
1, at first I met some iso - 2022 - jp? B type code, such as
"GyRCUn1SfRsoQg==" decoding should be "ha ha"
But using Delphi's own DecodeString Base64 decoding function (see http://hi.baidu.com/cobala/item/7ddd51245498c94247996249)
The decoding results "$BR} R} (B
", that is, its default decoding way as the "utf-8",
The situation I tried for a long time, in a fog was solved, after the process is probably will base64 code change into Tstream a base64tostream function (online), then use tsringlist loadfromstream (Tstream, iso - 2022 - jp encoding), tstringlist. The text is correct results after decoding,

2, and later met some utf-8? Q code, for example,
"=E4=B8=AD=E5=b=9 BD" decoding should be "Chinese"
I find N long also didn't find a can function on the Internet, and later heard that the Indy own IDCoderQuotedPrintable components can solve, I try after the results are as follows:
Procedure Tform1. Bitbtn1click (sender: tobject);
Var
STR: string;
The begin
STR:='=E4=B8===b=9 BD' E5 AD;
Edit1. Text:=TIdDecoderQuotedPrintable. Decodestring (STR);
end;
Results out of the "ghost?????? -??????? "This character, I found this out is to use the iso - 2022 - jp decoding way to solve it (you can use online decoding verify http://bianma.911cha.com/),,,,, this is how to return a responsibility?

Consult:
1, did you have greatly integrated function can solve the problem of all kinds of international code decoding once?
2, the decoding function of Delphi default decoding way how can anyone know? Online introduction to these functions are less good,
  • Related