db.propeties:
Value=吴秀梅,Beijing Refining Network Technology Co.Ltd.,北京市海淀区北三环西路32号楼7层0710-1,qianxiulan@yahoo.com,15652996964,210302199608124861,武水电字第3632734号,BWP018930705,0299233902,6212262502009182455
读取的数据是乱码:
[ÎâÐã÷, Beijing Refining Network Technology Co.Ltd., ±±¾©Êк£µíÇø±±Èý»·Î÷·32ºÅÂ¥7²ã0710-1, qianxiulan@yahoo.com, 15652996964, 210302199608124861, ÎäË®µç×ÖµÚ3632734ºÅ, BWP018930705, 0299233902, 6212262502009182455]
原来代码:
Properties pro = new Properties();
try{
//从配置文件中获取
InputStream in = Common.class.getClassLoader().getResourceAsStream(filename);
pro.load(in);
}
修改后不再出现乱码,代码
String enconding = "UTF-8";
if (isWindows())
enconding = "GBK";
Properties pro = new Properties();
try{
//从配置文件中获取
InputStream in = Common.class.getClassLoader().getResourceAsStream(filename);
pro.load(new InputStreamReader(in,enconding));
}



