生成utf-8带BOM的文件

FileOutputStream fos = new FileOutputStream(filePath);
Writer writer = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
fos.write(new byte[]{(byte)0xEF, (byte)0xBB, (byte)0xBF});

writer.append(fileContent);
writer.close();

 

你可能感兴趣的:(utf-8)