如何让此输入流读取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"));
没有。
答案 0 :(得分:3)
似乎:
BufferedReader r = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.jet), Charset.forName("ISO-8859-15")));
的工作原理。显然你需要发送一个Charset,而不是一个带有编码的字符串。鉴于此,这似乎很奇怪:
BufferedReader br = new BufferedReader(new InputStreamReader(ftp.getInputStream(), "ISO-8859-15"));