From af22f18296baa5dd6cafb5bbf9fdabb2de180273 Mon Sep 17 00:00:00 2001 From: est31 Date: Wed, 2 Nov 2016 12:51:15 +0100 Subject: [PATCH] Scanner: handle utf8 errors more gracefully Fixes #226 --- fdroidserver/scanner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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):