@@ -169,7 +169,7 @@ def _apply_mutators_for_type(
169169def python_mutator (
170170 args : _Args ,
171171) -> tuple [dict , dict [tuple [str , ...], Location ], Diagnostics ]:
172- input = json .load (open (args .input ))
172+ input = json .load (open (args .input , encoding = "utf-8" ))
173173 experimental = input .get ("experimental" , {})
174174
175175 if experimental .get ("pydabs" , {}) != {}:
@@ -446,14 +446,14 @@ def main(argv: list[str]) -> int:
446446 logging .basicConfig (level = logging .DEBUG , stream = sys .stderr )
447447 new_bundle , locations , diagnostics = python_mutator (args )
448448
449- with open (args .diagnostics , "w" ) as f :
449+ with open (args .diagnostics , "w" , encoding = "utf-8" ) as f :
450450 _write_diagnostics (f , diagnostics )
451451
452452 if locations_path := args .locations :
453- with open (locations_path , "w" ) as f :
453+ with open (locations_path , "w" , encoding = "utf-8" ) as f :
454454 _write_locations (f , locations )
455455
456- with open (args .output , "w" ) as f :
456+ with open (args .output , "w" , encoding = "utf-8" ) as f :
457457 _write_output (f , new_bundle )
458458
459459 return 1 if diagnostics .has_error () else 0
@@ -466,12 +466,12 @@ def _write_diagnostics(f: TextIO, diagnostics: Diagnostics) -> None:
466466 if obj .get ("path" ):
467467 obj ["path" ] = "." .join (obj ["path" ])
468468
469- json .dump (obj , f )
469+ json .dump (obj , f , ensure_ascii = False )
470470 f .write ("\n " )
471471
472472
473473def _write_output (f : TextIO , bundle : dict ) -> None :
474- json .dump (bundle , f )
474+ json .dump (bundle , f , ensure_ascii = False )
475475
476476
477477def _relativize_locations (
@@ -503,7 +503,7 @@ def _write_locations(f: TextIO, locations: dict[tuple[str, ...], Location]) -> N
503503 for path , location in locations .items ():
504504 obj = {"path" : "." .join (path ), ** location .as_dict ()}
505505
506- json .dump (obj , f )
506+ json .dump (obj , f , ensure_ascii = False )
507507 f .write ("\n " )
508508
509509
0 commit comments