日期:2014-05-20 浏览次数:21167 次
p.setProperty("sb", sb.length()<8 ? sb : sb.substring(0,8)+"...");
p.setProperty("reportname", reportname.length()<8 ? reportname : reportname.substring(0,8)+"...");
p.setProperty("paramdefault", paramdefault.length()<8 ? paramdefault : paramdefault.substring(0,8)+"...");
------解决方案--------------------
p.store(fw,"");
------解决方案--------------------
p.list(fw);
这个默认超过40个字符后,行为就和你描述的一样了
------解决方案--------------------
public static void main(String[] args) throws Exception {
PrintWriter inputStream=new PrintWriter("e:/aa.properties","UTF-8");
Properties properties=new Properties();
properties.setProperty("test", "中国");
properties.list(inputStream);
inputStream.close();
}
------解决方案--------------------
p.setProperty("reportname", reportTitle);
p.setProperty("paramdefault", paramDefault.toString());
reportTitle和paramDefault.toString()打印出来是乱码么?
如果这里是乱码就转码,然后
OutputStream out = new FileOutputStream(f);
OutputStreamWriter osw = new OutputStreamWriter(out,"utf-8");
p.setProperty("sb", "是乱码吗");
p.store(osw, "");