我有一个json数据
{
"description": "Architectures of Adobe\ufffds AEM Forms and LiveCycle ES4 systems. IT architects who are considering Adobe\ufffds AEM Forms and LiveCycle ES4 so\ufffdftware for their enterprise\ufffds form and document systems.",
"title" : "This course includes an introduction to the Creative Cloud and services such as Libraries, Adobe Stock, Typekit, Mobile Apps, and Bēhance."
}获取此数据的Java代码是-
HttpClient httpClient = new HttpClient();
HttpMethod method = new GetMethod(url);
method.addRequestHeader("accept", "application/json");
method.addRequestHeader("X-API-Key", apiKey);
method.addRequestHeader("certificate", certificate);
int status = httpClient.executeMethod(method);
JSONObject data = (JSONObject) JSONValue.parse(method.getResponseBodyAsString());
String desc = data.get("description").toString();
String data = data.get("title").toString();然而,我得到的结果是-
设计- AEM表单和LiveCycle ES4系统的体系结构。正在考虑为其企业级表单和文档系统使用AEM表单和LiveCycle ES4软件的IT架构师。
数据-本课程包括对Creative Cloud和服务的介绍,如库、Adobe股票、Typekit、移动应用程序和Creative
这似乎是一个如何修复this....Thanks的编码issue..Any想法
发布于 2017-03-10 09:17:26
请尝试在请求标头中包含Accept-Charset ...希望服务器遵守这一点,并将适当的字符集作为Content-Type响应头的一部分发送。此RFC 2616声明服务器应支持Accept-Charset
Accept-Charset的可能值包括但不限于...
utf-8
iso-8859-1
refer - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Charset
https://stackoverflow.com/questions/42706537
复制相似问题