如何在android中读取UTF-8 .text文件

时间:2014-04-07 13:48:50

标签: android file utf-8

在搜索不同的资源后,我想出了以下代码

StringBuilder stringBuilder = new StringBuilder();
String line;
BufferedReader in = null;
try {
    in = new BufferedReader(new InputStreamReader(new FileInputStream(currentFileName), "UTF-8"));
    while ((line = in.readLine()) != null) { 
        Log.d("line == " + line, "@@@@@@@@");
        stringBuilder.append(line);
    }
    in.close();
} catch (FileNotFoundException e) {
    Log.d("File not found", e.getMessage());
} catch (IOException e) {
    Log.d("IO Error", e.getMessage());
}

但它仍然没有完成这项工作。我明白了??????在输出。 有什么建议吗?

0 个答案:

没有答案