为什么往Property后缀的文件里面写汉字会出现时乱码,读取出来也是乱码,英文汉字就是正常的
import java.util.Properties;
import java.io.*;
public class Test2 {
	public static void main(String[] args) {
		System.out.println(System.getProperty("user.dir"));
		File file = new File(System.getProperty("user.dir")+"/src/student.properties");
		Properties p = new Properties();
		Reader in =null;
		try {
			in = new FileReader(file);
			BufferedReader br = new BufferedReader(in);
			p.load(br);
			System.out.println(p.getProperty("1.name"));
			p.setProperty("3.name","QinSheng");
			p.store(new FileOutputStream(file), null);
		} catch (
FileNotFoundException e) {
			e.printStackTrace();
		} catch (
IOException e) {
			e.printStackTrace();
		}
	}
}
------解决方案--------------------保存Unicode码不就行了
------解决方案--------------------peroperties.load(new InputStreamReader(new FileInputStream(file),"GBK"));
使用 InputStreamReader指定编码
------解决方案--------------------
------解决方案--------------------