From 78edcbb9e22307bd17350d32cea8e7517b304843 Mon Sep 17 00:00:00 2001 From: Fargier Sylvain Date: Mon, 28 Feb 2022 18:37:58 +0100 Subject: [PATCH] python: set file encoding - on some containers LC_ALL is not set, python fallsback on ascii encoder, which fails on AUTHORS file --- script/amalgamate.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/amalgamate.py b/script/amalgamate.py index e18ead9..a5377d7 100644 --- a/script/amalgamate.py +++ b/script/amalgamate.py @@ -3,7 +3,7 @@ processed_files = { } # authors for filename in ['AUTHORS', 'CONTRIBUTORS']: - with open(filename) as f: + with open(filename, encoding='utf8') as f: text = '' for line in f: if filename == 'AUTHORS': @@ -15,7 +15,7 @@ for filename in ['AUTHORS', 'CONTRIBUTORS']: # licenses for filename in ['LICENSE-MIT', 'LICENSE-APACHE']: lines = [] - with open(filename) as f: + with open(filename, encoding='utf8') as f: lines = f.readlines() # Retrieve subset required for inclusion in source @@ -34,7 +34,7 @@ for filename in ['LICENSE-MIT', 'LICENSE-APACHE']: for filename in [ 'fast_float.h', 'float_common.h', 'ascii_number.h', 'fast_table.h', 'decimal_to_binary.h', 'bigint.h', 'ascii_number.h', 'digit_comparison.h', 'parse_number.h']: - with open('include/fast_float/' + filename) as f: + with open('include/fast_float/' + filename, encoding='utf8') as f: text = '' for line in f: if line.startswith('#include "'): continue @@ -82,7 +82,7 @@ text = ''.join([ processed_files['parse_number.h']]) if args.output: - with open(args.output, 'wt') as f: + with open(args.output, 'wt', encoding='utf8') as f: f.write(text) else: print(text)