17
Views
4
Comments
Consume multipart/form-data parsing ... - Unrecognized escape sequence \݄.
Application Type
Mobile
Service Studio Version
11.55.35 (Build 64305)

Hi everyone,

I’m facing an error when working with Consume REST API in OutSystems to send data as multipart/form-data (payload containing binary file + metadata).

  • OutSystems version: 11.55.35
  • Application type:  Mobile
  • I’m using a REST Integration with the Body set as Binary Data.
  • Header: Content-Type: multipart/mixed; boundary=...
  • The payload is built on the client (Base64 encoded) → sent to the server → decoded into BinaryData → assigned to Body_Binary for the external API call.
  • The external API is an Oracle Cloud REST endpoint (or specify if different).


Issue:When the REST call runs, OutSystems throws the following exception and the call fails:

Error parsing "^�(Ъ�+x^�tɐJ p ^!�(�(0�z�O�"0��˟��� �^�F��|(oj:ġ����A� R(u"��NX;

Unrecognized escape sequence \݄.

   at System.Text.RegularExpressions.RegexParser.ScanCharEscape()

   at System.Text.RegularExpressions.RegexParser.ScanBasicBackslash()

   at System.Text.RegularExpressions.RegexParser.ScanRegex()

   at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)

   at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, TimeSpan matchTimeout, Boolean useCache)

   at System.Text.RegularExpressions.Regex.Replace(String input, String pattern, String replacement)

   at OutSystems.Internal.REST.MultipartHelper.EqualsIgnoreBoundaries(String oldMessageText, String newMessageText, String& newBoundary)


Consume_error.png
2024-10-09 04-44-30
Bhanu Pratap

"Unrecognized escape sequence" error hits when you consume multipart/form-data via a REST method with Body = Binary Data — the internal MultipartHelper regex chokes on certain binary bytes in the payload.

Switch to structured multipart:  

   Set Request Format = Multipart/Form-Data in the REST method.  

   Add individual parameters for each part (Text, Binary/File) instead of one raw Binary body.  

   Platform handles boundaries cleanly → no regex crash.  

   Doc: https://success.outsystems.com/documentation/11/integration_with_external_systems/rest/consume_rest_apis/consuming_a_rest_api_with_a_multipart_or_form_data_method

UserImage.jpg
Sang Le Van

My case also involves PDF files, but some are corrupted and some are not.
Bellow is my consume API detail


And you know why duplicate the filename in Content-Disposition?

Consume_error2.png
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Sang Le Van,

The simple question first: "why duplicate filename". It's not quite duplicate: one is "filename" the other "filename*". The latter is used with an encoding, see e.g. here for an explanation. I guess OS supplies both for optimal interoperability.

As for your error, I'm not directly sure where this comes from. As I understand correctly, OutSystems throws this error when sending the content right?

UserImage.jpg
Sang Le Van

Yes, I checked the logs and it seems the error occurred when the Outsystem sent the request.

I attchached a sample file that is using for the testing

ISTQB_CT-AI_Syllabus_v1.0.pdf
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.