packaging: don't use locale encoding to compute MD5 checksums
Open the file in binary mode or use UTF-8 encoding.
diff --git a/Lib/packaging/create.py b/Lib/packaging/create.py
index 837d0b6..0676cf1 100644
--- a/Lib/packaging/create.py
+++ b/Lib/packaging/create.py
@@ -400,10 +400,10 @@
self.data['description']).lower().encode())
ref = ref.digest()
for readme in glob.glob('README*'):
- with open(readme) as fp:
+ with open(readme, encoding='utf-8') as fp:
contents = fp.read()
- val = md5(re.sub('\s', '',
- contents.lower()).encode()).digest()
+ contents = re.sub('\s', '', contents.lower()).encode()
+ val = md5(contents).digest()
if val == ref:
del data['description']
data['description-file'] = readme