From ee19e4643e9bb4f08225fc56af3df54564741bad Mon Sep 17 00:00:00 2001 From: flier268 Date: Tue, 12 Mar 2019 17:00:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=91=BD=E4=BB=A4=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E5=9F=B7=E8=A1=8C=E7=B5=90=E6=9E=9C=E9=8C=AF=E8=AA=A4?= =?UTF-8?q?=E7=9A=84=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConvertZZ/App.xaml.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ConvertZZ/App.xaml.cs b/ConvertZZ/App.xaml.cs index dd4cb57..b91c8ff 100644 --- a/ConvertZZ/App.xaml.cs +++ b/ConvertZZ/App.xaml.cs @@ -164,7 +164,7 @@ private void Application_Startup(object sender, StartupEventArgs e) { using (Stream stream = new FileStream(f, FileMode.Open, FileAccess.Read, FileShare.Read)) { - using (StreamReader streamReader = new StreamReader(stream)) + using (StreamReader streamReader = new StreamReader(stream, encoding[0], false)) { s = streamReader.ReadToEnd(); } @@ -187,7 +187,7 @@ private void Application_Startup(object sender, StartupEventArgs e) s = ConvertHelper.FileConvert(s, encoding, ToChinese, VocabularyCorrection); if (ModeIsOneFile) { - using (StreamWriter streamWriter = new StreamWriter(path2)) + using (StreamWriter streamWriter = new StreamWriter(path2, false, encoding[1] == Encoding.UTF8 ? new UTF8Encoding(App.Settings.FileConvert.UnicodeAddBom) : encoding[1])) { streamWriter.Write(s); streamWriter.Flush(); @@ -210,7 +210,7 @@ private void Application_Startup(object sender, StartupEventArgs e) } Directory.CreateDirectory(Path.GetDirectoryName(@string)); - using (StreamWriter streamWriter = new StreamWriter(@string)) + using (StreamWriter streamWriter = new StreamWriter(@string, false, encoding[1] == Encoding.UTF8 ? new UTF8Encoding(App.Settings.FileConvert.UnicodeAddBom) : encoding[1])) { streamWriter.Write(s); streamWriter.Flush(); @@ -219,7 +219,7 @@ private void Application_Startup(object sender, StartupEventArgs e) else { Directory.CreateDirectory(Path.GetDirectoryName(path2)); - using (StreamWriter streamWriter = new StreamWriter(Path.Combine(Path.GetDirectoryName(path2), Path.GetFileName(f)))) + using (StreamWriter streamWriter = new StreamWriter(Path.Combine(Path.GetDirectoryName(path2), Path.GetFileName(f)), false, encoding[1] == Encoding.UTF8 ? new UTF8Encoding(App.Settings.FileConvert.UnicodeAddBom) : encoding[1])) { streamWriter.Write(s); streamWriter.Flush();