File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -170,12 +170,21 @@ export class Svn {
170170 } )
171171 ] ) ;
172172
173- jschardet . MacCyrillicModel . mTypicalPositiveRatio += 0.001 ;
173+ let encoding = "utf8" ;
174174
175- const encodingGuess = jschardet . detect ( stdout ) ;
175+ // SVN with '--xml' always return 'UTF-8', and jschardet detects this encoding: 'TIS-620'
176+ if ( ! args . includes ( "--xml" ) ) {
177+ jschardet . MacCyrillicModel . mTypicalPositiveRatio += 0.001 ;
176178
177- const encoding =
178- encodingGuess . confidence > 0.8 ? encodingGuess . encoding : "utf8" ;
179+ const encodingGuess = jschardet . detect ( stdout ) ;
180+
181+ if (
182+ encodingGuess . confidence > 0.8 &&
183+ iconv . encodingExists ( encodingGuess . encoding )
184+ ) {
185+ encoding = encodingGuess . encoding ;
186+ }
187+ }
179188
180189 stdout = iconv . decode ( stdout , encoding ) ;
181190
You can’t perform that action at this time.
0 commit comments