Skip to content

Commit

Permalink
make it possibile to set encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Decker committed Feb 9, 2023
1 parent cdf1787 commit 4878eba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spdx/writers/write_anything.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from spdx.parsers.builderexceptions import FileTypeError


def write_file(doc, fn, validate=True):
def write_file(doc, fn, validate=True, encoding="utf-8"):
out_mode = "w"
if fn.endswith(".rdf") or fn.endswith(".rdf.xml"):
writer_module = rdf
Expand All @@ -34,5 +34,5 @@ def write_file(doc, fn, validate=True):
else:
raise FileTypeError("FileType Not Supported")

with open(fn, out_mode) as out:
with open(fn, out_mode, encoding=encoding) as out:
p = writer_module.write_document(doc, out, validate)

0 comments on commit 4878eba

Please sign in to comment.