【发布时间】:2015-03-28 04:17:02
【问题描述】:
我正在寻找一种可行的解决方案,以 UTF-8 对字符串进行编码。
我是 Android 新手,请耐心等待。 ;)
我尝试了所有我能找到的解决方案,但没有任何效果!
这是我的代码:
public void Loader(String nameFile) throws FileNotFoundException {
File file = new File(nameFile);
FileInputStream f_is = new FileInputStream(file);
BufferedInputStream b_is = new BufferedInputStream(f_is);
BufferedReader data = new BufferedReader(new InputStreamReader(b_is));
try {
while ( (BufferTemp=data.readLine()) != null) {
if (BufferTemp.contains("****")) {
Titolo = data.readLine();
Tempo = data.readLine();
Persone = data.readLine();
Piatto = data.readLine();
Ingredienti = data.readLine();
Altro = data.readLine();
Descrizione = data.readLine();
EncodedBkg = data.readLine();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
如何将Descrizione 编码为 UTF-8 字符串??
我接受任何解决方案,欢迎对我的代码进行所有更改,但我需要逐行阅读文件。
【问题讨论】:
标签: android string encoding utf-8