From: Michael Tremer Date: Tue, 4 Jul 2023 09:47:40 +0000 (+0000) Subject: importer: Skip lines we cannot decode X-Git-Tag: 0.9.17~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56f147cec37c5261969a07c0f9b732bb289d85f4;p=location%2Flibloc.git importer: Skip lines we cannot decode Signed-off-by: Michael Tremer --- diff --git a/src/scripts/location-importer.in b/src/scripts/location-importer.in index 7b47668..e1ec873 100644 --- a/src/scripts/location-importer.in +++ b/src/scripts/location-importer.in @@ -1325,7 +1325,14 @@ class CLI(object): for line in f: lineno += 1 - line = line.decode() + try: + line = line.decode() + + # Ignore any lines we cannot decode + except UnicodeDecodeError: + log.debug("Could not decode line %s in %s" \ + % (lineno, geofeed.url)) + continue # Strip any newline line = line.rstrip()