您好,我正在从两个不同的文件中读取英语和南非荷兰语,并将其放入一个 sqlite 数据库中,例如南非荷兰语中的单词是正确的
南非荷兰语单词在下面
'n slegte lot
'n voël die wilde diere van die prooi
'n trekvogel
==================================================== ========
public class MainActivity extends Activity {
DbAdapterSDCard db;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String array[] = { "afrikaans" };
for (int j = 0; j < array.length; j++) {
String filePath1 = "/sdcard/Dictionarys/english.txt";
String filePath2 = "/sdcard/Dictionarys/" + array[j] + ".txt";
String UTF8 = "utf8";
int BUFFER_SIZE = 8192;
int i = 0;
System.out.println(array[j]);
db = new DbAdapterSDCard(array[j]);
try {
db.open();
File file = new File(filePath3);
file.createNewFile();
BufferedReader br1 = new BufferedReader(new InputStreamReader(
new FileInputStream(filePath1),UTF8), BUFFER_SIZE);
BufferedReader br2 = new BufferedReader(new InputStreamReader(
new FileInputStream(filePath2), UTF8), BUFFER_SIZE);
String sCurrentLine1, sCurrentLine2;
while ((sCurrentLine1 = br1.readLine()) != null
&& ((sCurrentLine2 = br2.readLine()) != null)) {
db.insertTitle(sCurrentLine1, sCurrentLine2);
}
} catch (Exception e) {
e.printStackTrace();
}
try {
db.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
但是在sqlite中它是这样插入的
两者都有编码 UTF-8 字符集............
谁能建议我我已经尝试了很多但不能成功
txt文件中的编码如下
现在如果我使用编码 utf-8 字符将无法正确显示:(