package com.qunar.basicJava.javase.io;
import java.io.*;
/**
* Author: libin.chen@qunar.com Date: 14-6-6 10:01
*/
public class Encoding {
public static void main(String[] args) throws IOException {
System.out.println(System.getProperty("file.encoding"));
// 系统本地的编码是 UTF-8
File file = new File("/home/hp/tmp/test.txt");
OutputStream outputStream = new FileOutputStream(file);
byte b[] = "中国,你好!".getBytes("UTF-8");
outputStream.write(b);;
outputStream.close();
}
}
字符编码初步
转载于:https://www.cnblogs.com/robbychan/p/3786489.html