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.