Skip to content

Commit

Permalink
Merge pull request #356 from transifex/parse_file_with_bom
Browse files Browse the repository at this point in the history
Remove BOM (Byte Order Mark) bytes
  • Loading branch information
arisktfx authored Nov 4, 2024
2 parents da3e7c2 + 8201865 commit 9b4fdee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions openformats/formats/docx.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ def get_document(self):
with io.open(self.__document_path, 'r') as f:
self.__document = f.read()

if self.__document.startswith("\ufeff"):
# Remove BOM
self.__document = self.__document.replace("\ufeff", "")

return self.__document

def set_document(self, document):
Expand Down

0 comments on commit 9b4fdee

Please sign in to comment.