Indy在每72个字符处添加=多部分表单数据Post

Wiz*_*ard 3 delphi post multipartform-data indy delphi-xe

使用Delphi XE和Indy,我得到了一些提交到Web表单的代码.

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;
Run Code Online (Sandbox Code Playgroud)

但是,当我在描述备忘录中输入类似的内容时.

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.
Run Code Online (Sandbox Code Playgroud)

我明白了

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.
Run Code Online (Sandbox Code Playgroud)

所以它对我来说似乎是包装词,有=任何有线索的人?

Rem*_*eau 7

你看到的是正确的行为.该TIdFormDataField.ContentTransfer属性默认quoted-printable为文本字段.这正是您所看到的编码类型.在quoted-printable,一个=后跟换行符的唯一字符称为"软"断点.这就是MIME如何分解长行文本以适应各种协议(如电子邮件)中的行长度限制.

您可以将ContentTransfer属性更改为以下任何受支持的值:

  • 一个空白字符串
  • 7bit
  • 8bit
  • binary
  • quoted-printable
  • base64

如果您不希望对文本进行编码,请将该ContentTransfer属性设置为除quoted-printableor 之外的任何值base64.