From: est31 Date: Wed, 2 Nov 2016 11:51:15 +0000 (+0100) Subject: Scanner: handle utf8 errors more gracefully X-Git-Tag: 0.8~151^2 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=af22f18296baa5dd6cafb5bbf9fdabb2de180273;p=fdroidserver.git Scanner: handle utf8 errors more gracefully Fixes #226 --- diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index 289e041a..6e06f7c5 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -199,7 +199,7 @@ def scan_source(build_dir, root_dir, build): elif ext == 'java': if not os.path.isfile(fp): continue - with open(fp, 'r', encoding='utf8') as f: + with open(fp, 'r', encoding='utf8', errors='replace') as f: for line in f: if 'DexClassLoader' in line: count += handleproblem('DexClassLoader', fd, fp) @@ -208,7 +208,7 @@ def scan_source(build_dir, root_dir, build): elif ext == 'gradle': if not os.path.isfile(fp): continue - with open(fp, 'r', encoding='utf8') as f: + with open(fp, 'r', encoding='utf8', errors='replace') as f: lines = f.readlines() for i, line in enumerate(lines): if is_used_by_gradle(line):