Und nun mal in sauber(er)
Delphi-Quellcode:
uses ..., IdCoderQuotedPrintable, JclUnicode;
var sBody : WideString;
function ConvertQuotedPrintable( AText : String ) : String;
var Decoder : TIdDecoderQuotedPrintable;
begin
Decoder := TIdDecoderQuotedPrintable.Create(nil);
try
Result := Decoder.DecodeToString( AText );
finally
FreeAndNil( Decoder );
end;
end;
function ConvertUTF8( AText : WideString ) : WideString;
begin
Result := UTF8ToWideString(AText);
end;
if Pos( 'quoted-printable', IdMessage.ContentTransferEncoding ) > 0 then
sBody := ConvertQuotedPrintable(IdMessage.Body.Text)
else
sBody := IdMessage.Body.Text;
if Pos( 'utf-8', IdMessage.ContentType ) > 0 then
sBody := ConvertUTF8(sBody);