@@ -34,7 +34,7 @@ def safeGetLine( lines, index ):
3434
3535def safeReadFile ( path ):
3636 try :
37- return file ( path , 'rt' ).read ()
37+ return open ( path , 'rt' , encoding = 'utf-8 ' ).read ()
3838 except IOError as e :
3939 return '<File "%s" is missing: %s>' % (path ,e )
4040
@@ -77,13 +77,13 @@ def runAllTests( jsontest_executable_path, input_dir = None,
7777 base_path = os .path .splitext (input_path )[0 ]
7878 actual_output = safeReadFile ( base_path + '.actual' )
7979 actual_rewrite_output = safeReadFile ( base_path + '.actual-rewrite' )
80- file (base_path + '.process-output' ,'wt' ).write ( process_output )
80+ open (base_path + '.process-output' , 'wt' , encoding = 'utf-8 ' ).write ( process_output )
8181 if status :
8282 print ('parsing failed' )
8383 failed_tests .append ( (input_path , 'Parsing failed:\n ' + process_output ) )
8484 else :
8585 expected_output_path = os .path .splitext (input_path )[0 ] + '.expected'
86- expected_output = file ( expected_output_path , 'rt' ).read ()
86+ expected_output = open ( expected_output_path , 'rt' , encoding = 'utf-8 ' ).read ()
8787 detail = ( compareOutputs ( expected_output , actual_output , 'input' )
8888 or compareOutputs ( expected_output , actual_rewrite_output , 'rewrite' ) )
8989 if detail :
0 commit comments