I use IBM worklight to develop a hybrid app. In the local development environment everything is OK.
I have an issue when I deploy to an external server (with oracle database). My app calls a webservice via an adapter, but the data in the response has an encoding problem: unicode characters do not display correctly. I changed the charset (in the adapter invoke function) to ISO-8859-1, and then unicode characters display correctly.
function invokeWebService(body, headers, soapAction) {
var input = {
method : 'post',
returnedContentType : 'xml',
path : '/transaction/services/TransactionService.TransactionServiceHttpSoap11Endpoint/',
body: {
content : body.toString(),
contentType : 'text/xml; charset=ISO-8859-1'
}
};
//Adding custom HTTP headers if they were provided as parameter to the procedure call
//Always add header for SOAP action
headers = headers || {};
if (soapAction != 'null')
headers.SOAPAction = soapAction;
input['headers'] = headers;
return WL.Server.invokeHttp(input);
}
However the problem then happens again when I want to insert data to database (oracle with default charset UTF-8). The data has been inserted with error charset (because ISO-8859-1).
How can I get data response correct charset with UTF-8 without having to change the encoding from the webservice?
Or get data with ISO-8859-1 charset and insert data to database with UTF-8?