[damned-lies] Refs #247 - Add more encoding params with file I/O



commit a1ceb2316424e9055e41d483c9ba4bdb4ada57d8
Author: Claude Paroz <claude 2xlibre net>
Date:   Thu Jul 29 09:39:31 2021 +0200

    Refs #247 - Add more encoding params with file I/O

 stats/management/commands/update-trans.py | 2 +-
 stats/utils.py                            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/stats/management/commands/update-trans.py b/stats/management/commands/update-trans.py
index c1d1d729..500e53e4 100644
--- a/stats/management/commands/update-trans.py
+++ b/stats/management/commands/update-trans.py
@@ -63,7 +63,7 @@ class Command(BaseCommand):
 
     def _update_django_po_with_database_strings(self):
         self.dbfile = settings.BASE_DIR / self.database_content_filename
-        with self.dbfile.open("w") as fh:
+        with self.dbfile.open("w", encoding="utf-8") as fh:
             for value in itertools.chain(
                 Team.objects.values_list("description", flat=True),
                 Language.objects.exclude(name__exact=F("locale")).values_list("name", flat=True),
diff --git a/stats/utils.py b/stats/utils.py
index bbb16b29..3689637e 100644
--- a/stats/utils.py
+++ b/stats/utils.py
@@ -187,7 +187,7 @@ class MakefileWrapper:
     @cached_property
     def content(self):
         try:
-            content = self.path.read_text()
+            content = self.path.read_text(encoding='utf-8')
         except IOError:
             return None
         return content


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]