1
我有一個JSON數據字符編碼GET API調用
{
"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();
但是我得到的結果原樣
說明 - Adobe的AEM Forms和LiveCycle ES4系統的體系結構。正在考慮Adobe?AEM Forms和LiveCycle ES4軟件的IT架構師爲其企業形成和記錄系統。
數據 - 這當然包括介紹創意雲和,如圖書館,Adobe公司的股票,Typekit,移動應用和BÄhance
服務似乎是一個編碼issue..Any知道如何解決這個問題。 ...謝謝
爲什麼你的文字有'\ ufffd'()替換字符在第一個地方呢?看起來像你有字符集轉換問題之前,你甚至到了這一步。 – Andreas
Json數據來自第三方API的這種格式....我想我需要爲此做適當的編碼....但不知道如何..........預期的輸出desc必須是 - Adobe的AEM Forms和LiveCycle ES4系統的體系結構。 IT架構師正在考慮將Adobe的AEM Forms和LiveCycle ES4軟件用於企業的表單和文檔系統。 – Tapan