From 260d36484dbf7eec0a05dafff253692318125ac5 Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Thu, 12 Dec 2024 22:37:58 -0500 Subject: .pytool/LicenseCheck: Open files in utf-8 The LicenseCheck plugin currently fails if a file contains characters outside the platform-dependent encoding returned from locale.getencoding(). This change updates the encoding to utf-8 so the plugin is more robust while continuing to support backward compatibility with the ASCII range. Signed-off-by: Michael Kubacki --- .pytool/Plugin/LicenseCheck/LicenseCheck.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pytool/Plugin/LicenseCheck/LicenseCheck.py b/.pytool/Plugin/LicenseCheck/LicenseCheck.py index 7b998daf6f..9e596bb083 100644 --- a/.pytool/Plugin/LicenseCheck/LicenseCheck.py +++ b/.pytool/Plugin/LicenseCheck/LicenseCheck.py @@ -70,7 +70,7 @@ class LicenseCheck(ICiBuildPlugin): temp_diff_output = os.path.join (temp_path, 'diff.txt') params = "diff --output={} --unified=0 origin/master HEAD".format(temp_diff_output) RunCmd("git", params) - with open(temp_diff_output) as file: + with open(temp_diff_output, encoding='utf8') as file: patch = file.read().strip().split("\n") # Delete temp directory if os.path.exists(temp_path): -- cgit