@@ -90,8 +90,8 @@ def to_json(self, filename=None):
9090 results [issue .detector_name ][issue .level ] = []
9191 results [issue .detector_name ][issue .level ].append (issue .description )
9292 if filename is not None :
93- with open (filename , "w" ) as json_file :
94- json .dump (results , json_file , indent = 4 )
93+ with open (filename , "w" , encoding = "utf-8" ) as json_file :
94+ json .dump (results , json_file , indent = 4 , ensure_ascii = False )
9595 else :
9696 return json .dumps (results , indent = 4 )
9797
@@ -115,7 +115,7 @@ def to_html(self, filename=None, embed=False):
115115 html = widget .render_html (embed = embed )
116116
117117 if filename is not None :
118- with open (filename , "w" ) as f :
118+ with open (filename , "w" , encoding = "utf-8" ) as f :
119119 f .write (html )
120120 return
121121
@@ -139,7 +139,7 @@ def to_markdown(self, filename=None, template="summary"):
139139 markdown = widget .render_markdown (template = template )
140140
141141 if filename is not None :
142- with open (filename , "w" ) as f :
142+ with open (filename , "w" , encoding = "utf-8" ) as f :
143143 f .write (markdown )
144144 return
145145
@@ -349,7 +349,7 @@ def to_avid(self, filename=None):
349349 ]
350350
351351 if filename is not None :
352- with open (filename , "w" ) as f , warnings .catch_warnings ():
352+ with open (filename , "w" , encoding = "utf-8" ) as f , warnings .catch_warnings ():
353353 warnings .filterwarnings ("ignore" , category = DeprecationWarning ) # we need to support both pydantic 1 & 2
354354 f .writelines (r .json () + "\n " for r in reports )
355355 return
@@ -373,7 +373,7 @@ def generate_rails(self, filename=None, colang_version="1.0"):
373373 _rails = generate_rails_from_scan_report (self , colang_version = colang_version )
374374
375375 if filename :
376- with open (filename , "a" ) as f :
376+ with open (filename , "a" , encoding = "utf-8" ) as f :
377377 f .write (_rails )
378378 return
379379
0 commit comments