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

 

相关文章:

  • 2021-12-16
  • 2021-12-28
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-12-14
相关资源
相似解决方案