Skip to Content
0
Mar 27, 2015 at 02:11 PM

XSJS Charset problem on SP9

947 Views

Hi Experts,

I'm executing a simple select inside a xsjs service, and after, returning the result in a json format. All works fine, except that, after SP9 (rev 93) upgrade, the charset is no longer working. See below:

Table PEOPLE:

Name | Surname

João | Silva

Here the XSJS file:

$.response.contentType = 'application/json; charset=utf-8';

var conn = $.db.getConnection();

var pstmt = conn.prepareStatement( 'select * from "PEOPLE"' );

var rs = pstmt.executeQuery();

var jsonArr = [];

while (rs.next()){

jsonArr.push({

name: rs.getString(1),

suname: rs.getString(2)

});

}

rs.close();

pstmt.close();

conn.close();

$.response.setBody(JSON.stringify(jsonArr));

$.response.status = $.net.http.OK;

When running SP8, the result was the following:

[

- { name: "João", suname : "Silva" }

]


Now running SP9, the result is:


[

-{

name: "João", suname : "Silva" }

]


Do you know how can I solve this?


Thanks and regards,

Roberto Falk