首页 > 代码库 > 获取TXT文件,乱码问题

获取TXT文件,乱码问题

        /// <summary>
        /// 获取到过滤字TXT,将其放入到字符串中
        /// </summary>
        public static void LoadIllegalchar()
        {
            string fileName = AppDomain.CurrentDomain.BaseDirectory.ToString() + "Filter.txt";
            if (File.Exists(fileName))
            {
                StreamReader sr = new StreamReader(fileName, Encoding.UTF8);  //这句话就不乱码了;
                LimitedChar = sr.ReadLine();
            }
        }