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 HTTP.post 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
Subscribe

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome content in your inbox, every month.

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

If the form isn't cooperating, don't worry. Just drop us an email at info(at)martechnotes(dot)com with 'Subscribe' in the subject line, and we'll be happy to add you to our list. As a token of our appreciation, we'll also send you a free e-book. Your subscription means a lot to us, and we want to ensure you don't miss out on our valuable content.