@@ -164,7 +164,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
164
164
{
165
165
using ( Stream stream = new FileStream ( f , FileMode . Open , FileAccess . Read , FileShare . Read ) )
166
166
{
167
- using ( StreamReader streamReader = new StreamReader ( stream ) )
167
+ using ( StreamReader streamReader = new StreamReader ( stream , encoding [ 0 ] , false ) )
168
168
{
169
169
s = streamReader . ReadToEnd ( ) ;
170
170
}
@@ -187,7 +187,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
187
187
s = ConvertHelper . FileConvert ( s , encoding , ToChinese , VocabularyCorrection ) ;
188
188
if ( ModeIsOneFile )
189
189
{
190
- using ( StreamWriter streamWriter = new StreamWriter ( path2 ) )
190
+ using ( StreamWriter streamWriter = new StreamWriter ( path2 , false , encoding [ 1 ] == Encoding . UTF8 ? new UTF8Encoding ( App . Settings . FileConvert . UnicodeAddBom ) : encoding [ 1 ] ) )
191
191
{
192
192
streamWriter . Write ( s ) ;
193
193
streamWriter . Flush ( ) ;
@@ -210,7 +210,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
210
210
}
211
211
212
212
Directory . CreateDirectory ( Path . GetDirectoryName ( @string ) ) ;
213
- using ( StreamWriter streamWriter = new StreamWriter ( @string ) )
213
+ using ( StreamWriter streamWriter = new StreamWriter ( @string , false , encoding [ 1 ] == Encoding . UTF8 ? new UTF8Encoding ( App . Settings . FileConvert . UnicodeAddBom ) : encoding [ 1 ] ) )
214
214
{
215
215
streamWriter . Write ( s ) ;
216
216
streamWriter . Flush ( ) ;
@@ -219,7 +219,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
219
219
else
220
220
{
221
221
Directory . CreateDirectory ( Path . GetDirectoryName ( path2 ) ) ;
222
- using ( StreamWriter streamWriter = new StreamWriter ( Path . Combine ( Path . GetDirectoryName ( path2 ) , Path . GetFileName ( f ) ) ) )
222
+ 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 ] ) )
223
223
{
224
224
streamWriter . Write ( s ) ;
225
225
streamWriter . Flush ( ) ;
0 commit comments