Campaign: JSSPs not returning proper character encoding

Description

It has been reported that when using JSSPs that the content type is not returning “application/json; charset=utf-8”.

Resolution

Sometimes within the Header ContentType an error is thrown as it has not been properly defined. As such the application will return “application/json; charset=iso-8859-1” instead.

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