2

I am using HTTP get method to get the data from API,But the response returned from the API is not encoded in proper format.The Same response in Postman looks perfect. The content from Postman looks like

“Göttingen Channels”

The content which i receive in LP as a result of GET METHOD is

“Göttingen Channelsâ€

Header key value pairs which i set in HTTP GET method is

var headerNames = ["secret-token", "apikey","Accept-Encoding"];

var headerValues = ["78996", "4128","utf-8"];

And the response headersfrom get method which i debugged from IE inspector looks like

what change should i implement in the headers to get the exact characters printed?It looks like i am missing some thing in my code.

4
  • 1
    I don't have an answer, but I can certainly understand your frustration, as I had a similar problem recently trying to get emoji to be passed in through a REST API without corruption. In my situation, I resolved the issue by changing from HttpPost to HttpGet. Have you tried other settings for the char set? Maybe charset=ISO-8859-1? salesforce.stackexchange.com/questions/203193/… Commented Feb 6, 2018 at 23:43
  • Can you try setting the headernames to "content-type" and values as "text/html;charset=utf-8"
    – Lakshmi
    Commented Feb 7, 2018 at 4:12
  • MC SSJS HTTP GET method is not allowing to set the content-type as header value, i get error when we set the content type Commented Feb 7, 2018 at 14:07
  • @ManojChandran did you ever figure this out? I'm having same issue. Commented Nov 24, 2022 at 1:38

1 Answer 1

0

You can use GetPostData() function that encodes by default on Windows-1252. And then add your encoding in the optional parameter of the function :

var postdata = Platform.Request.GetPostData('utf-8');

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .