Campaign: JSSPs not returning proper character encoding

Last update: 2022-11-08

Description

Environment

  • Campaign Classic
  • Campaign

Issue/Symptoms
Sometimes within the header ContentType an error is thrown as it has not been properly defined. When using JSSPs that the content type is not returning application/json; charset=utf-8.

Resolution

To fix this, add ContentType in JavaScript before the rest of the code is executed.

%
response.setContentType("text/html;charset=utf-8");
%

or

%
response.setContentType('application/json;charset=utf-8");
%

Sample

%
response.setContentType('application/json');
var x = {'Element1':'Element2'};
document.write(JSON.stringify(x));
%

On this page