background shape
background shape

Fix HTTP post request wrong encoding

Recently, while working with the double opt-in process that employs an API to trigger transactional messages, I encountered an issue where Latin characters, characters with accent, were not captured correctly in the triggered send data extension.

I have found that the SFMC HTTPPost uses, by default, WindowsCodePage 1252 encoding, which can cause issues with accented characters such as ž, ň, or ä.

To resolve this issue, we need to set our own content type header in our request. However, it’s essential not to include it as an additional header, as doing so will result in a 500 internal server error. Instead, add the encoding to the second argument.

var contentType = "application/json; charset=utf-8",
HTTP.Post(url, contentType, Stringify(payload), [], []);

This way all the form submitted and pushed to transactional API will have correct encoding in the data extension.

Oh hi there 👋
I have a FREE e-book for you.

Sign up now to get an in-depth analysis of Adobe and Salesforce Marketing Clouds!

We don’t spam! Read our privacy policy for more info.

Share With Others

Leave a Comment

Your email address will not be published. Required fields are marked *

MarTech consultant

Marcel Szimonisz

Marcel Szimonisz

I specialize in solving problems, automating processes, and driving innovation through major marketing automation platforms.

Buy me a coffee