Skip to content

Commit 49f9369

Browse files
committed
fix: correct way to write utf-8 encoded files
Signed-off-by: Paul Horton <[email protected]>
1 parent e6451a3 commit 49f9369

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cyclonedx/output/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def output_to_file(self, filename: str, allow_overwrite: bool = False):
6969
if os.path.exists(output_filename) and not allow_overwrite:
7070
raise FileExistsError
7171

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

7575
f_out.close()
7676

0 commit comments

Comments
 (0)