diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2021-02-23 23:42:11 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2021-02-23 23:42:11 +0000 |
commit | 9732f4e80f906fab85b97ae55ee44bfd3ee4945e (patch) | |
tree | 179a01a01190f727b9432d9989951134c6f0f1d7 /boilerplate/make-cairo-boilerplate-constructors.py | |
parent | d85738b39c2fe01ec09b83d2e1b88fa918939a01 (diff) |
meson: use encoding=utf-8 when reading/writing files in helper script
Fixes errors such as
Traceback (most recent call last):
File "C:\Users\...\cairo\test\make-cairo-test-constructors.py", line 19, in <module>
for l in f.readlines():
File "c:\python39\lib\encodings\cp1253.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 6694: character maps to <undefined>
on non-English-language Windows locales/installations.
Diffstat (limited to 'boilerplate/make-cairo-boilerplate-constructors.py')
-rw-r--r-- | boilerplate/make-cairo-boilerplate-constructors.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/boilerplate/make-cairo-boilerplate-constructors.py b/boilerplate/make-cairo-boilerplate-constructors.py index 8e02fa500..40198ed1a 100644 --- a/boilerplate/make-cairo-boilerplate-constructors.py +++ b/boilerplate/make-cairo-boilerplate-constructors.py @@ -16,12 +16,12 @@ if __name__=='__main__': match_boilerplate_name = re.compile(r'^CAIRO_BOILERPLATE.*\((.*),.*') for fname in args.input: - with open(fname, 'r') as f: + with open(fname, 'r', encoding='utf-8') as f: for l in f.readlines(): if match_boilerplate_line.match(l): boilerplate_names.append(match_boilerplate_name.match(l).group(1)) - with open(args.output, 'w') as f: + with open(args.output, 'w', encoding='utf-8') as f: f.write('/* WARNING: Autogenerated file - see %s! */\n\n' % sys.argv[0]) f.write('#include "cairo-boilerplate-private.h"\n\n') f.write('void _cairo_boilerplate_register_all (void);\n\n') |