java.util.Properties p = System.getProperties(); System.out.println("-------- listing properties ---------");
Set keys = p.keySet();
for (Iterator iter = new TreeSet (keys).iterator(); iter.hasNext(); ) {
String key = (String) iter.next();
String val = (String) p.get(key);
System.out.println (key + "=" + val);
}
You will find this:
sun.io.unicode.encoding=UnicodeLittle
Set keys = p.keySet();
for (Iterator iter = new TreeSet (keys).iterator(); iter.hasNext(); ) {
String key = (String) iter.next();
String val = (String) p.get(key);
System.out.println (key + "=" + val);
}
You will find this:
sun.io.unicode.encoding=UnicodeLittle
"abc".getBytes();
但是实际上取出的编码和gb2312相同,而且gb2312的编码和gbk相同,unicode=unicodeLittle!=UTF8!=UTF16,这到底是怎么回事?字符串到底是按照什么取默认编码的?
p.get( "file.encoding" );