Search code examples
delphidelphi-7indy

Indy. Error posting String with %


I am using Indy 9.00.10 under Delphi 7.

I use TIdMultiPartFormDataStream to post some data using TIdHTTP. When I try to post some param with a text value including % in it, for instance '100% brand' it raises "No Argument for format %".

It seems to me that it is calling some format function to the value I am trying to post and it expects every % to be a placeholder, wich is not my case.

Is this a known issue? Is there a workaround for it?


Solution

  • You are using a very old version of Indy. The last release of Indy 9 was 9.0.50, which is available in Indy's SVN. This issue was fixed in 9.0.13.

    If you do not want to upgrade, then a workaround is to double up any '%' characters in your field data so they get formatted as a single '%' character, eg:

    Stream.AddFormField('FieldName', StringReplace(FieldValue, '%', '%%', [rfReplaceAll]));