Skip to content

Commit

Permalink
.pytool/LicenseCheck: Open files in utf-8
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
makubacki authored and mergify[bot] committed Dec 19, 2024
1 parent b8602d8 commit 260d364
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .pytool/Plugin/LicenseCheck/LicenseCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM,
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):
Expand Down

0 comments on commit 260d364

Please sign in to comment.