Forcing StreamWriter to change Encoding

后端 未结 5 1237
没有蜡笔的小新
没有蜡笔的小新 2020-12-14 06:58

I am trying to save a file using DialogResult and StringBuilder. After making the text, I am calling the following code to save the file:



        
5条回答
  •  孤街浪徒
    2020-12-14 07:35

    setting UTF8 encoding working with Arabic font is the best thing I did:

     using (var sw = new StreamWriter(
    
     new FileStream(temporaryFilePath,    
                   FileMode.Create,
                   FileAccess.ReadWrite), 
                   Encoding.UTF8))
                {
                    sw.Write(sb.ToString());
                }
     )
    

提交回复
热议问题