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

  • 相关阅读:
    面试题整理
    Node.js核心模块-stream流
    Node.js核心模块-crypto加密
    Node.js核心模块-assert
    Node.js全局对象-process
    nodemon
    随笔
    python学习笔记(十四): unittest
    python学习笔记(十三): 多线程多进程
    python学习笔记(十二):发送邮件
  • 原文地址:https://www.cnblogs.com/meimao5211/p/3293496.html
Copyright © 2011-2022 走看看