From 94cb0a6837042dbdbd4e5a837c4447d91e1848fd Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 28 Feb 2020 18:15:05 -0800 Subject: [PATCH] check_whence: python3/utf-8 support WHENCE contains non-ASCII characters, so we should specify an encoding. To get the encoding= arg in python2, we pull open from 'io' directly. Signed-off-by: Brian Norris Signed-off-by: Josh Boyer --- check_whence.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/check_whence.py b/check_whence.py index 04f41df..2d31f38 100755 --- a/check_whence.py +++ b/check_whence.py @@ -1,9 +1,10 @@ #!/usr/bin/python import os, re, sys +from io import open def list_whence(): - with open('WHENCE') as whence: + with open('WHENCE', encoding='utf-8') as whence: for line in whence: match = re.match(r'(?:File|Source):\s*"(.*)"', line) if match: