Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Attachment is converted from 8-bit encoding to binary encoding



Setting the pyAttachFileNames property on pyRequestAttachmentPage, converts the content of the attachment from 8-bit encoding to binary encoding. As a result, the attachement displays as corrupted.

Error Messages

Not Applicable.

Steps to Reproduce

  1. Create a Connect-REST rule to send multi-part attachments
  2. Set the properties pyAttachNames, pyAttachValues, pyAttachTypes and pyAttachFileNames on the pyRequestAttachmentPage in the activity calling the Connect-REST rule
  3. Set the value of property pyAttachValues to JSON content and set the value of pyAttachTypes as 'application/json'
  4. Invoke the activity and capture the generated request content using the TCPMon utility. In this case the Content-Transfer-Encoding is set to binary even though JSON content is sent in multi-part attachments
  5. Test the same use case by removing the pyAttachFileNames property from pyRequestAttachmentPage. Without setting the pyAttachFileNames property, the Content-Transfer-Encoding is set to 8-bit for the JSON content sent in the multi-part attachment

Root Cause

An issue in the custom application code or rules. 

The values that the application enters in the pyAttachValues property must be base64-encoded representations of the content for the Parts of the message, regardless of the content-type. Additionally, the application should populate the pyAttachTypes property in order to provide the Content-Type headers for the remote endpoint to use when interpreting the transmitted data. In this case, the value set for the pyAttachValues property was not base64-encoded content.


Perform the following local-change: 
  1. Set the value for pyAttachValues property on the pyRequestAttachmentPage such that it is base64-encoded content
  2. Set the value for pyAttachTypes property such that the value is Content-Type (for example, application/json, text/plain) as expected by the remote endpoint for interpreting the multi-part message content


Published July 27, 2018 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us