private static void transferFile(String srcFileName, String destFileName) throws IOException { String line_separator = System.getProperty("line.separator"); FileInputStream fis = new FileInputStream(srcFileName); StringBuffer content = new StringBuffer(); DataInputStream in = new DataInputStream(fis); BufferedReader d = new BufferedReader(new InputStreamReader(in, "GBK"));// , "UTF-8" String line = null; while ((line = d.readLine()) != null) content.append(line + line_separator); d.close(); in.close(); fis.close(); Writer ow = new OutputStreamWriter(new FileOutputStream(destFileName), "utf-8"); ow.write(content.toString()); ow.close(); }
详细解决方案
一个GBK编码的资料转成UTF8编码的文件
热度:101 发布时间:2012-10-12 10:17:04.0
相关解决方案
- big5 utf8 sqlserver编码有关问题
- svn: 索引中的条目从本地编码转换到 UTF8 失败
- 使用"SET NAMES UTF8"后,出现乱码解决思路
- jsp utf 乱码异常 com.caucho.jsp.JspParseException: illegal utf8 encoding at 0xdf
- query.exec("set names utf8") 这是啥意思,该怎么处理
- Android中检测字符编码(GB2312,ASCII,UTF8,UNICODE,TOTAL——ENCODINGS)步骤(二)
- C# 中 UTF8Encoding.UTF8.GetBytes(key),对应PHP中的哪个方法? 如何写
- 使用"SET NAMES UTF8"后,出现乱码解决思路
- MySQL 怎么修改字符集 utf8 改为 utf8mb4
- utf8-to-utf8mb4 mysql支持全部unicode
- 前端中常见字节编码(base64、hex、utf8)及其转换
- 使用Ant编译过程中,报error: unmappable character for encoding UTF8
- VB不使用 API,将 Utf8 转换为 Unicode
- Windows下的字符集转换(ASCII、UICODE、UTF8、GB2312和BIG5互转)
- UTF-8在IE中不能自动选择编码的解决办法(utf8 网页在ie中自动编码乱码问题)
- UTF8/ANSI/UNICODE文件读取
- 用ant编译时出现“编码 UTF8 的不可映射字符“,这是因为编译的时候编码跟文件存储的编码方式不一样造成的
- 对字符编码与Unicode,ISO 10646,UCS,UTF8,UTF16,GBK,GB2312的理解
- 火车头采集器 内容发布 utf8 模板 utf-8 乱码