summaryrefslogtreecommitdiff
path: root/giscanner/utils.py
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2020-11-07 08:41:42 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2020-11-07 08:57:06 +0100
commit5f966b0b8d61e2abf003439b2f93a9bd19be798c (patch)
tree530128d2a9ee1a0b4cd3c9702d5de5862943aa1f /giscanner/utils.py
parent19c67f77e23cf80da957bfa0b28c1b31d81339f0 (diff)
downloadgobject-introspection-5f966b0b8d61e2abf003439b2f93a9bd19be798c.tar.gz
Always pass an encoding to open() using text mode
Otherwise we'll end up using the locale encoding. While it's usually utf-8, that's not the case on Windows. There is one place where a file with filenames is passed, not sure there so I left it and passed a explicit None.
Diffstat (limited to 'giscanner/utils.py')
-rw-r--r--giscanner/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/giscanner/utils.py b/giscanner/utils.py
index d9938fc7..85c0b910 100644
--- a/giscanner/utils.py
+++ b/giscanner/utils.py
@@ -84,7 +84,7 @@ _libtool_pat = re.compile("dlname='([A-z0-9\\.\\-\\+]+)'\n")
def _extract_dlname_field(la_file):
- with open(la_file) as f:
+ with open(la_file, encoding='utf-8') as f:
data = f.read()
m = _libtool_pat.search(data)
if m:
@@ -97,7 +97,7 @@ _libtool_libdir_pat = re.compile("libdir='([^']+)'")
def _extract_libdir_field(la_file):
- with open(la_file) as f:
+ with open(la_file, encoding='utf-8') as f:
data = f.read()
m = _libtool_libdir_pat.search(data)
if m: