Attachemnt Decoding

Giganews Newsgroups
Subject: Attachemnt Decoding
Posted by:  Alan Barnett (somebo…@parasense.co.uk)
Date: Tue, 11 Apr 2006

I am experiencing a decode issue when attempting to save a csv attachment
from an email using Indy 10, Delphi 6 and calling the SaveToFile() method of
a TIdAttachment object.

If the email is 'Content-Transfer-Encoding: 7bit' the attachement is saved
successfully.

If the email is 'Content-Transfer-Encoding: quoted-printable' the
attachement is saved but there appears to be file corruption under the
following circumstances :

The format of the 'quoted-printable' attachment seems to divide lines into
pre-defined character length chunks using an '=' character as a continuation
character, e.g. :

,1023510904062,AY48694,kWh,09/04/06,3.6,3.5,3.6,3.7,3.6,3.5,3.7,3.7,3.6,3=
.6,3.8,3.7,4.3,4.1,12.9,11.9,10.9,11.2,12.8,13.2,15.0,14.9,14.7,14.2,12.7=
,13.0,12.9,12.9,13.1,11.7,11.3,4.9,4.0,4.0,3.9,3.7,3.7,3.6,3.7,3.7,3.5,3.=
4,2.9,2.9,2.8,2.8,2.9,2.7

The issue I am experiencing is that if the character immediately following
the continuation chacter is a '.' then an additional '.' character is
inserted into the saved file at that position. In the above example this
results in the following line being saved to file where 3.6 becomes 3..6 :

,1023510904062,AY48694,kWh,09/04/06,3.6,3.5,3.6,3.7,3.6,3.5,3.7,3.7,3.6,3..6,3.8,3.7,4.3,4.1,12.9,11.9,10.9,11.2,12.8,13.2,15.0,14.9,14.7,14.2,12.7,13.0,12.9,12.9,13.1,11.7,11.3,4.9,4.0,4.0,3.9,3.7,3.7,3.6,3.7,3.7,3.5,3.4,2.9,2.9,2.8,2.8,2.9,2.7

Is there a way to prevent this from happening?

Any comments gratefully received,

Al B

Replies