3
我試圖用解析JSON JSON-簡單1.1.1JSON-簡單的UTF-8解析Java中
public static void main(String[] args) throws ParseException, IOException{
BufferedReader buff = new BufferedReader(new FileReader("src/qqqqqqqq/json"));
String line = null;
while((line = buff.readLine()) != null){
JSONParser parser = new JSONParser();
Object obj = (Object) parser.parse(line);
JSONObject jsonObj = (JSONObject) obj;
System.out.println((String)jsonObj.get("name"));
}
}
使用UTF-8我的JSON源文件沒有BOM
{"name":"ą"}
{"name":"ć"}
{"name":"ń"}
{"name":"ź"}
{"name":"ż"}
{"name":"ó"}
println輸出:
Ä…
ć
Ĺ„
Ĺş
ĹĽ
Ăł
我在做什麼錯了?
[JSON字符編碼]的可能重複(http://stackoverflow.com/questions/3995559/json-character-encoding) – Mohit