4

如何让这个输入流读取 ISO-8859-15 编码文件?

BufferedReader r = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.jet)));

我发现这条线似乎有效:

BufferedReader br = new BufferedReader(new InputStreamReader(ftp.getInputStream(), "ISO-8859-15"));

BufferedReader r = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.jet), "ISO-8859-15"));

才不是。

4

1 回答 1

5

看起来:

BufferedReader r = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.jet), Charset.forName("ISO-8859-15")));

作品。显然,在这种情况下,您需要发送一个字符集,而不是带有编码的字符串。鉴于此,这似乎很奇怪:

BufferedReader br = new BufferedReader(new InputStreamReader(ftp.getInputStream(), "ISO-8859-15"));
于 2012-05-03T08:30:22.197 回答