diff options
| author | practicalswift <[email protected]> | 2018-06-12 17:49:20 +0200 |
|---|---|---|
| committer | practicalswift <[email protected]> | 2018-06-12 21:34:52 +0200 |
| commit | 634bd970013eca90f4b4c1f9044eec8c97ba62c2 (patch) | |
| tree | cf308babc695722ab55344bcd27b1b68802ce3f9 /contrib/devtools/copyright_header.py | |
| parent | Merge #13066: Migrate verify-commits script to python, run in travis (diff) | |
| download | discoin-634bd970013eca90f4b4c1f9044eec8c97ba62c2.tar.xz discoin-634bd970013eca90f4b4c1f9044eec8c97ba62c2.zip | |
Explicitly specify encoding when opening text files in Python code
Diffstat (limited to 'contrib/devtools/copyright_header.py')
| -rwxr-xr-x | contrib/devtools/copyright_header.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/devtools/copyright_header.py b/contrib/devtools/copyright_header.py index 82d3c1968..da7d74bdc 100755 --- a/contrib/devtools/copyright_header.py +++ b/contrib/devtools/copyright_header.py @@ -146,7 +146,7 @@ def file_has_without_c_style_copyright_for_holder(contents, holder_name): ################################################################################ def read_file(filename): - return open(os.path.abspath(filename), 'r').read() + return open(os.path.abspath(filename), 'r', encoding="utf8").read() def gather_file_info(filename): info = {} @@ -325,13 +325,13 @@ def get_most_recent_git_change_year(filename): ################################################################################ def read_file_lines(filename): - f = open(os.path.abspath(filename), 'r') + f = open(os.path.abspath(filename), 'r', encoding="utf8") file_lines = f.readlines() f.close() return file_lines def write_file_lines(filename, file_lines): - f = open(os.path.abspath(filename), 'w') + f = open(os.path.abspath(filename), 'w', encoding="utf8") f.write(''.join(file_lines)) f.close() |