Skip to content

Commit

Permalink
Read and write file in binary mode to remove BOM (Byte Order Mark) bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
arisktfx committed Oct 29, 2024
1 parent da3e7c2 commit d36491d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openformats/formats/docx.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def __init__(self, content):

def get_document(self):
if self.__document is None:
with io.open(self.__document_path, 'r') as f:
with io.open(self.__document_path, 'rb') as f:
self.__document = f.read()

return self.__document
Expand All @@ -137,7 +137,7 @@ def set_document(self, document):

def get_document_rels(self):
if self.__document_rels is None:
with io.open(self.__document_rels_path, 'r') as f:
with io.open(self.__document_rels_path, 'rb') as f:
self.__document_rels = f.read()

return self.__document_rels
Expand Down

0 comments on commit d36491d

Please sign in to comment.