Mega Search
23.2 Million


Sign Up

Make a donation  
Using tidDecoderQuotedPrintable  
News Group: embarcadero.public.delphi.internet.winsock

I am trying to use idDecoderQuotedPrintable to return plain text from an email that is using quoted printable content.  Here is what I have tried so far.

s := 'Hi Andy =E2=80=93 =20  Thanks for the potential opportunity to work with Chronicle in a large= '+
'r capacity.  Let me give you a little summary as to what I=E2=80=99m s= ';


memo1.lines.text := idDecoderQuotedPrintable.DecodeString(s);

Thanks for your help

Daniel

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 5-Jan-2015, at 10:15 AM EST
From: Daniel Manchester
 
Re: Using tidDecoderQuotedPrintable  
News Group: embarcadero.public.delphi.internet.winsock
Found the problem on my side of the fence.  Sorry to trouble you.  Thanks again for your speedy, competent help Remy!



> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> Daniel wrote:
> 
> > My goal is to retrieve the message body as plain text but I am finding
> > characters in the message body like  =E2=80=93 =20  are showing up
> > as #$D#$A in the string
> 
> I seriously doubt that.  Those particular encoded sequences do not decode 
> into those particular characters.
> 
> > when retrieved like this
> > s := TIdText(idMsg.MessageParts.Items[i]).Body.text;
> 
> TIdMessage already decodes QP-encoded text by default when parsing the email. 
>  Why are you decoding the text manually afterwards?  The only way TIdMessage 
> would not decode is if either 1) you told it not to, by setting its NoDecode 
> property to true, or 2) the email is malformed and missing a required "Content-Transfer-Encoding: 
> quoted-printable" header.
> 
> Can you show the original email?  And what version of Indy are you using?
> 
> --
> Remy Lebeau (TeamB)

Vote for best answer.
Score: 10  # Vote:  1
Date Posted: 8-Jan-2015, at 3:13 PM EST
From: Daniel Manchester
 
Re: Using tidDecoderQuotedPrintable  
News Group: embarcadero.public.delphi.internet.winsock
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> Daniel wrote:
> 
> > My goal is to retrieve the message body as plain text but I am finding
> > characters in the message body like  =E2=80=93 =20  are showing up
> > as #$D#$A in the string
> 
> I seriously doubt that.  Those particular encoded sequences do not decode 
> into those particular characters.
> 
> > when retrieved like this
> > s := TIdText(idMsg.MessageParts.Items[i]).Body.text;
> 
> TIdMessage already decodes QP-encoded text by default when parsing the email. 
>  Why are you decoding the text manually afterwards?  The only way TIdMessage 
> would not decode is if either 1) you told it not to, by setting its NoDecode 
> property to true, or 2) the email is malformed and missing a required "Content-Transfer-Encoding: 
> quoted-printable" header.
> 
> Can you show the original email?  And what version of Indy are you using?
> 
> --
> Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 8-Jan-2015, at 3:12 PM EST
From: Daniel Manchester
 
Re: Using tidDecoderQuotedPrintable  
News Group: embarcadero.public.delphi.internet.winsock
Daniel wrote:

> My goal is to retrieve the message body as plain text but I am finding
> characters in the message body like  =E2=80=93 =20  are showing up
> as #$D#$A in the string

I seriously doubt that.  Those particular encoded sequences do not decode 
into those particular characters.

> when retrieved like this
> s := TIdText(idMsg.MessageParts.Items[i]).Body.text;

TIdMessage already decodes QP-encoded text by default when parsing the email. 
 Why are you decoding the text manually afterwards?  The only way TIdMessage 
would not decode is if either 1) you told it not to, by setting its NoDecode 
property to true, or 2) the email is malformed and missing a required "Content-Transfer-Encoding: 
quoted-printable" header.

Can you show the original email?  And what version of Indy are you using?

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 5-Jan-2015, at 1:24 PM EST
From: Remy Lebeau (TeamB)
 
Re: Using tidDecoderQuotedPrintable  
News Group: embarcadero.public.delphi.internet.winsock
Sorry for the lack of detail.  

My goal is to retrieve the message body as plain text but I am finding characters in the message body like  =E2=80=93 =20  are showing up as #$D#$A in the string when retrieved like this s := TIdText(idMsg.MessageParts.Items[i]).Body.text;

Thanks again for your help Remy!


> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> Daniel wrote:
> 
> > I am trying to use idDecoderQuotedPrintable to return plain text
> > from an email that is using quoted printable content.
> 
> What is the actual problem you are having with it?  You need to be more specific. 
>  And why are you not letting Indy parse and decode the email for you?
> 
> > Here is what I have tried so far.
> 
> What was the expected result?  What was the actual result?
> 
> > s := 'Hi Andy =E2=80=93 =20 Thanks for the potential opportunity to work 
> with Chronicle in a large= '+
> > 'r capacity. Let me give you a little summary as to what I=E2=80=99m s= ';
> 
> This data is not valid, as '= ' is not a valid QP sequence.  I suspect you 
> are intending to use a "soft" line break in between the two substrings, in 
> which case you need a CRLF immediately after the '=' without a space following 
> it, eg:
> 
> {code}
> s := 'Hi Andy =E2=80=93 =20 Thanks for the potential opportunity to work 
> with Chronicle in a large='+EOL+
>       'r capacity. Let me give you a little summary as to what I=E2=80=99m 
> s='+EOL+...;
> {code}
> 
> > memo1.lines.text := idDecoderQuotedPrintable.DecodeString(s);
> 
> DecodeString() is a 'class' method, so you don't need an object instance 
> to call it:
> 
> {code}
> memo1.lines.text := TIdDecoderQuotedPrintable.DecodeString(s);
> {code}
> 
> --
> Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 5-Jan-2015, at 1:13 PM EST
From: Daniel Manchester
 
Re: Using tidDecoderQuotedPrintable  
News Group: embarcadero.public.delphi.internet.winsock
Daniel wrote:

> I am trying to use idDecoderQuotedPrintable to return plain text
> from an email that is using quoted printable content.

What is the actual problem you are having with it?  You need to be more specific. 
 And why are you not letting Indy parse and decode the email for you?

> Here is what I have tried so far.

What was the expected result?  What was the actual result?

> s := 'Hi Andy =E2=80=93 =20 Thanks for the potential opportunity to work 
with Chronicle in a large= '+
> 'r capacity. Let me give you a little summary as to what I=E2=80=99m s= ';

This data is not valid, as '= ' is not a valid QP sequence.  I suspect you 
are intending to use a "soft" line break in between the two substrings, in 
which case you need a CRLF immediately after the '=' without a space following 
it, eg:

{code}
s := 'Hi Andy =E2=80=93 =20 Thanks for the potential opportunity to work 
with Chronicle in a large='+EOL+
      'r capacity. Let me give you a little summary as to what I=E2=80=99m 
s='+EOL+...;
{code}

> memo1.lines.text := idDecoderQuotedPrintable.DecodeString(s);

DecodeString() is a 'class' method, so you don't need an object instance 
to call it:

{code}
memo1.lines.text := TIdDecoderQuotedPrintable.DecodeString(s);
{code}

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 5-Jan-2015, at 12:12 PM EST
From: Remy Lebeau (TeamB)