Android 原始资源 .txt 显示符号
Android raw resource .txt show symbols
我尝试使用原始资源文件夹来存储文本文件。
(而不是硬编码)。
文本是希伯来语,所以它是 RTL(我不认为这是问题所在)。
问题是我得到的不是文本而是符号。(����.)
这就是我在资源文件中获取文本的方式
InputStream inputStream = this.getResources().openRawResource(id);
byte[] buffer = new byte[1024];
int bufferLength = 0;
String name = getNameByID(id);
FileOutputStream fos = openFileOutput(name,MODE_PRIVATE);
try {
while ((bufferLength = inputStream.read(buffer)) > 0){
fos.write(buffer,0,bufferLength);
}
} catch (IOException e) {
e.printStackTrace();
}
有什么建议吗?
好吧,我找到了解决方案...
删除文件并重新放置它们。
如果失败,请尝试手动粘贴数据(CTRL+V)。
我尝试使用原始资源文件夹来存储文本文件。 (而不是硬编码)。 文本是希伯来语,所以它是 RTL(我不认为这是问题所在)。 问题是我得到的不是文本而是符号。(����.)
这就是我在资源文件中获取文本的方式
InputStream inputStream = this.getResources().openRawResource(id);
byte[] buffer = new byte[1024];
int bufferLength = 0;
String name = getNameByID(id);
FileOutputStream fos = openFileOutput(name,MODE_PRIVATE);
try {
while ((bufferLength = inputStream.read(buffer)) > 0){
fos.write(buffer,0,bufferLength);
}
} catch (IOException e) {
e.printStackTrace();
}
有什么建议吗?
好吧,我找到了解决方案... 删除文件并重新放置它们。 如果失败,请尝试手动粘贴数据(CTRL+V)。