Skip to content

Commit

Permalink
fix: ensure output to file is UTF-8
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Horton <phorton@sonatype.com>
  • Loading branch information
madpah committed Oct 21, 2021
1 parent 193bf64 commit a10da20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cyclonedx/output/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def output_to_file(self, filename: str, allow_overwrite: bool = False):
if os.path.exists(output_filename) and not allow_overwrite:
raise FileExistsError

with open(output_filename, mode='wb') as f_out:
f_out.write(self.output_as_string().encode('utf-8'))
with open(output_filename, mode='w') as f_out:
f_out.write(self.output_as_string(), encoding='utf-8')

f_out.close()

Expand Down

0 comments on commit a10da20

Please sign in to comment.