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();
            }

  • 相关阅读:
    python socket练习
    python异常处理
    python类的反射
    类的特殊成员方法
    staticmethod classmethod property方法
    类的多态
    类的析构、继承
    python subprocess模块
    python面向对象
    discuz 使模板中的函数不解析 正常使用
  • 原文地址:https://www.cnblogs.com/moss_tan_jun/p/1793039.html
Copyright © 2011-2022 走看看