Fix xml archiver encoding bug (#349)

* test_integration: add archiver tests

* archiver.py: fix encoding bug in xml archiver
This commit is contained in:
Ali Parlakçı
2021-05-06 16:11:48 +03:00
committed by GitHub
parent 4ab1d6d6e0
commit a2e22e894a
2 changed files with 3 additions and 2 deletions

View File

@@ -89,7 +89,7 @@ class Archiver(RedditDownloader):
def _write_content_to_disk(self, resource: Resource, content: str):
file_path = self.file_name_formatter.format_path(resource, self.download_directory)
file_path.parent.mkdir(exist_ok=True, parents=True)
with open(file_path, 'w') as file:
with open(file_path, 'w', encoding="utf-8") as file:
logger.debug(
f'Writing entry {resource.source_submission.id} to file in {resource.extension[1:].upper()}'
f' format at {file_path}')