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).
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)
"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
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?
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?
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