zoukankan      html  css  js  c++  java
  • 把TXT GB2312文件转换成TXT UTF8文件

         

     /// <summary>
            /// 把TXT GB2312文件转换成TXT UTF8文件
            /// </summary>
            /// <param name="filepath"></param>
            /// <param name="filepath2"></param>
            private void FileGB2312TOFileUTF8(string filepath, string filepath2)
            {
                filepath = Server.MapPath(filepath);
                filepath2 = Server.MapPath(filepath2);

                StreamReader inStream = new StreamReader(filepath, Encoding.GetEncoding(936));//GB2312
                StreamWriter outStream = new StreamWriter(filepath2, false, Encoding.GetEncoding(65001));//UTF8
                char[] chBuffer = new char[1000];
                int iCount;
                while ((iCount = inStream.Read(chBuffer, 0, 1000)) > 0)
                {

                    outStream.Write(chBuffer, 0, iCount);
                }
                inStream.Close();
                outStream.Close();
            }

  • 相关阅读:
    揭秘富人的22种习惯与风格
    CSS
    浏览器--编辑器
    3 位运算 , 补码 ----在开发中比较少用
    2 Java数据类型+转义字符
    1 概述
    如何使用大脑
    JDBC
    web.xml文件的作用
    WindowBuilder插件探索
  • 原文地址:https://www.cnblogs.com/moss_tan_jun/p/1793039.html
Copyright © 2011-2022 走看看