字符编码
import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import org.omg.CORBA.portable.OutputStream; public class code_demo { public static void main(String[] args) throws Exception { // TODO 自动生成的方法存根 System.out.println("系统默认编码:"+System.getProperty("file.encoding")); //获取系统当前的编码 File file = new File("/home/common/software/coding/HelloWord/HelloWord/b.txt");//路径 FileOutputStream out = new FileOutputStream(file); byte b[] = "中国".getBytes("ISO8859-1"); out.write(b); out.close(); } }
本文只发表于博客园和tonglin0325的博客,作者:tonglin0325,转载请注明原文链接:https://www.cnblogs.com/tonglin0325/p/5281735.html