1 package 字符编码;
 2 
 3 import java.io.File;
 4 import java.io.FileOutputStream;
 5 import java.io.IOException;
 6 import java.io.OutputStream;
 7 import java.io.UnsupportedEncodingException;
 8 
 9 public class TestGetProperties {
10     public static void main(String[] args) throws UnsupportedEncodingException, IOException {
11         System.getProperties().list(System.out);//输出当前环境属性
12         File file=new File("D:"+File.separator+"test.txt");
13         OutputStream out=new FileOutputStream(file);
14         out.write("黄山黄河长江长城".getBytes("UTF-8"));//无乱码
15         out.write("黄山黄河长江长城".getBytes("ISO8859-1"));//有乱码
16         out.close();
17     }
18 }
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-10
  • 2022-01-15
  • 2021-05-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-21
  • 2022-12-23
  • 2021-06-13
  • 2021-09-25
相关资源
相似解决方案