Delphi XE7 Bug breaks ISAPI applications

Delphi XE7 Bug breaks ISAPI applications

There is a serious bug in Delphi XE7 that breaks all ISAPI applications using UTF8ContentParser unit, not only IntraWeb ISAPI applications.

The problem occurs because the TUTF8ContentParser class, used to parse the content fields received in a web request, do not decode them properly, so they are unusable.

Please check this piece of code of UTF8ContentParser unit in Delphi XE6:

      if Decode then
        AddString(HTTPDecode(AnsiString(DoStripQuotes(ExtractedField))))
      else…

This is the same piece of code in Delphi XE7 (line 161):

    if Decode then
        AddString(AnsiString(TNetEncoding.URL.Encode(string(DoStripQuotes(ExtractedField)))))  

as you can see, the deprecated functions HTTPDecode() was replaced by new TNetEncoding methods. But, as you can see, instead of calling TNetEncoding.URL.Decode() method, it is using the wrong method Encode().

We already have a workaround in IntraWeb that should fix it. It will be available in the next release. If you need to do a workaround urgently, please change the source code of UTF8ContentParser.pas and add it to your project explicitely. You should do this:

    if Decode then
        AddString(AnsiString(TNetEncoding.URL.Decode(string(DoStripQuotes(ExtractedField)))))  

This should fix that.

We have already informed this bug to Embarcadero and we expect they to fix it soon.