So I have a webservice call that is giving me back a JSON string. I've requested that the response send be back the content in UTF-8 encoding. When I inspect the value returned everything looks good. It's when I create a new JSONObject and pass the JSON text into the constructor that things start to cause problems.
Specifically: The webservice returns with an EM DASH (http://www.fileformat.info/info/unicode/char/2014/index.htm) character in the response - "format":"On Demand Event—All Sessions"
After the JSONObject receives the string it converts this character into the java representation of this character - "format":"On Demand Event\u2014All Sessions"
I am using the org.json library to do my bidding and am considering moving to a different implementation if necessary. Here is what I've got running the show:
HttpClient client = new HttpClient();
GetMethod getDownloads = new GetMethod("http://localhost:8080/ecommerce-ws/service/account/downloads");
getDownloads.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "UTF-8");
getDownloads.setRequestHeader("Accept", "application/json");
client.executeMethod(getDownloads);
String httpResponse = getDownloads.getResponseBodyAsString();
JSONObject downloadsJSON = new JSONObject(httpResponse);
Is there some way that I can set the character encoding on the JSONObject when it parses the string? I've done quite a bit of looking around and have found very little that helps.
Thank you in advance for your assistance.