' - '被转换为'使用json阅读器从json读取

时间:2013-11-22 17:54:18

标签: android json

我读了一个包含一些电话号码的json文件。像这样的东西:     “号码”:“416-736-5088”

我使用JsonReader解析它并将其保存到列表中。

private void populateOfficeList() throws IOException {
    officeList.clear();
    InputStream in = null;
    JsonReader jsonReader = null;
    try {
        in = openFileInput(OFFICE_JSON);    
        System.out.println("got in " + in);
        jsonReader = new JsonReader(new InputStreamReader(in, "UTF-8"));
        readofficeListMessageArray(jsonReader, officeList);
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } finally {
        jsonReader.close();
        in.close();
    }

}

一切正常。它解析并妥善保存。但是,当我获取这些数字进行显示时,它们会显示如下:     416A€?736A€?5217

我已经在使用UTF-8进行转换了。我该如何摆脱这些角色?

1 个答案:

答案 0 :(得分:1)

欢迎来到奇妙的字符编码世界。确保您正在阅读的文件也以UTF-8格式保存。