[gi-docgen: 2/3] Fix enoding error which was raised when opening a file See https://gitlab.gnome.org/ebassi/gi-docgen




commit bfa0b4a6ac39b322bdd73ccc936d5cce62b9f375
Author: Naveen M K <naveen@syrusdark.website>
Date:   Sun Mar 28 23:18:31 2021 +0530

    Fix enoding error which was raised when opening a file
    See https://gitlab.gnome.org/ebassi/gi-docgen/-/issues/67#note_1068932

 gidocgen/gdgenerate.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gidocgen/gdgenerate.py b/gidocgen/gdgenerate.py
index 6e110b9..d432209 100644
--- a/gidocgen/gdgenerate.py
+++ b/gidocgen/gdgenerate.py
@@ -2210,7 +2210,7 @@ def gen_content_files(config, theme_config, content_dir, output_dir, jinja_env,
         src_file = os.path.join(content_dir, file_name)
 
         src_data = ""
-        with open(src_file, "r") as infile:
+        with open(src_file, encoding='utf-8') as infile:
             source = []
             for line in infile:
                 source.append(line)
@@ -2233,7 +2233,7 @@ def gen_content_files(config, theme_config, content_dir, output_dir, jinja_env,
         }
 
         log.info(f"Generating content file {file_name}: {dst_file}")
-        with open(dst_file, "w") as outfile:
+        with open(dst_file, "w", encoding='utf-8') as outfile:
             outfile.write(content_tmpl.render({
                 "CONFIG": config,
                 "namespace": namespace,


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