Reputation: 12702
With Delphi XE and Indy, I got some code which submits to a web form.
idhttp := TidHttp.create;
postData := TIdMultiPartFormDataStream.Create;
try
postData.AddFormField('name', edName.text);
postData.AddFormField('email', edEmail.txt);
postData.AddFormField('description', mDescription.text);
idhttp.Request.ContentType := 'Content-Type: multipart/form-data; boundary=' + postData.Boundary;
idhttp.fHttp.Post('http://www.example.com/contact.php', postData);
ShowMessage('Thank you for your contact us.');
finally
postData.Free;
idHttp.Free;
end;
However, when I enter something likes this in the description memo.
This is a really long descriptie piece of text so we can see just how it's wrapping these lines and what it's doig to them I think it's making a hash of it.
Argh waht a pain.
I get
This is a really long descriptie piece of text so we can see just how =
it's wrapping these lines and what it's doig to them I think it's maki=
ng a hash of it.
Argh waht a pain.
So it seems to be word wrapping for me, with = Anyone with any clues?
Upvotes: 3
Views: 2333
Reputation: 596612
What you see is correct behavior. The TIdFormDataField.ContentTransfer
property defaults to quoted-printable
for text fields. That is exactly the type of encoding you are seeing being generated. In quoted-printable
, a sole =
character followed by a line break is called a "soft" break. It is how MIME breaks up long lines of text to fit within line length restrictions in various protocols, such as email.
You can change the ContentTransfer
property to any of the following supported values:
7bit
8bit
binary
quoted-printable
base64
If you do not want your text to be encoded, then set the ContentTransfer
property to any of the values other than quoted-printable
or base64
.
Upvotes: 9
Reputation: 189487
It encodes the stuff as quoted-printable. You need to decode it before displaying it.
Upvotes: 1