"             image=╬image/a╬+imageList[i].value+╬.gif╬;\r\n"解析后用StreamWriter写入文件后发现文件内变成:image="image/"+imageList[i].value+".gif";/后面的a没了!!!!不仅如此,经过多次测试后 发现 / 后面放再多字母,写入文件后都会消失  -0-比如"/aaaaaaaaaaaafasjflsahfiusahfsaiof025"会变成"/025" 
如何解决??????

解决方案 »

  1.   

       string path = filename;
                try
                {
                    if (isunicode)
                    {
                        using (StreamWriter sw = new StreamWriter(path, isAppend, Encoding.Unicode))
                        {
                            sw.WriteLine(line);
                        }
                    }
                    else
                    {
                        using (StreamWriter sw = new StreamWriter(path, isAppend))
                        {
                            sw.WriteLine(line);
                        }
                    }                return true;
                }
      

  2.   

    失望中
    无语的回答写入方法是公共的我用来写了几十个页面都没问题
    既然有人要看,那我就贴出来,看看是否如你所说是代码问题:/// <summary>
            /// 文件写入
            /// </summary>
            /// <param name="UserID"></param>
            /// <param name="fileName"></param>
            /// <param name="htmlCode"></param>
            private static void CreateFile(string UserID, string fileName, string htmlCode)
            {
                fileName += fileName.IndexOf(".html") != -1 ? "" : ".html";
                string localPath = "E:/DotNet/Sun/SunDecorativeSystem/Users/" + UserID;
                if (!Directory.Exists(localPath))
                {
                    Directory.CreateDirectory(localPath);
                }
                localPath += "/" + fileName;
                if (File.Exists(localPath))
                {
                    File.Delete(localPath);
                }
                FileStream fs = new FileStream(localPath, FileMode.CreateNew);
                StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
                sw.AutoFlush = true;
                htmlCode = htmlCode.Replace("╬", "\"");
                sw.Write(htmlCode);
                sw.Flush();
                sw.Close();
                fs.Close();
            }