Properties pro = new Properties();
pro.setProperty("1","test1");
pro.setProperty("2","test2");
pro.setProperty("3","test3");
try {
FileOutputStream fos = new FileOutputStream("d:\\obj.txt");
pro.store(fos, "属性");
fos.close();
}
catch (IOException ex) {
}
pro.setProperty("1","test1");
pro.setProperty("2","test2");
pro.setProperty("3","test3");
try {
FileOutputStream fos = new FileOutputStream("d:\\obj.txt");
pro.store(fos, "属性");
fos.close();
}
catch (IOException ex) {
}
默认的符集好象是8859_1。
自己写一个转换
或写一个支持选择字符集的Properties
你可以把在JAVA源码中找到Properties这个类源码,自己只要把那个8859_1的字符集
改为GB2312等支持中文的字符集就行了,不过,单独拿出来,有的时候会出错
你自己改改就行了。
我在项目中也是把源代码改了,然后就可以用中文