1

I am using a simple SSJS code from here. I have updated the Fire Entry API end point as below.

/*=== SFMC REST API === */
  var payload = {   "ContactKey": Account_ID,
                                "EventDefinitionKey":eventkey,
                                "EstablishContactKey": true, 
                                "Data": {   "Account_ID":Account_ID,
                                            "Person_Email": Person_Email, 
                                            "Contact_Salutation":Contact_Salutation, 
                                            "Contact_First_Name": Contact_First_Name, 
                                            "Contact_Last_Name":Contact_Last_Name
                                           
                                        }   
                            };
  var route = "interaction/v1/events";  
 Write("<br><br>payload = " + Stringify(payload) + "<br><br>");
//  Write("<br><br>restUrl = " + restUrl +route+  "<br><br>");
  var contentType = 'application/json'; 
  var headerNames = ["Authorization"];
  var headerValues = ["Bearer "+accessToken];
  var result = HTTP.Post(restUrl+route, contentType, Stringify(payload), headerNames, headerValues);
  if (result.StatusCode == 201) {
    var responseJSON = Platform.Function.ParseJSON(result.Response[0]);
   // Write(Stringify(responseJSON)+"<br><br>"); //response
  }
  else {
    throw new Error("Error calling API");
  }
  • When I Output the 'Payload' in cloud page, the Japanese characters display in Japanese.

However when they get stored in Data Extension they display as ???1 ??????????? enter image description here

  • Also I noticed, when I use the same payload from POSTMAN, it works like a champ and Japanese charecters are correctly displayed on both Cloud page as well as in DataExtension!

Any help/advice on this! I know this is something to do with 'UTF-8' encoding... but just looking where to add/Syntax of adding it!

3

1 Answer 1

3

Can you try this:

var contentType = 'application/json; charset=UTF-16';
1
  • Thanks for the quick response, this worked @JonasLamberty Commented Feb 1, 2023 at 8:39

You must log in to answer this question.

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