From 62618313405e094feda6e4c79ae0b14635987b15 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Wed, 26 Oct 2016 16:20:44 +0200 Subject: [PATCH] indexing: gracefully fall back to ISO8859 if UTF-8 gives an error --- resource.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resource.py b/resource.py index 4dcc75f..7dd93df 100644 --- a/resource.py +++ b/resource.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Helmut Merz helmutm@cy55.de +# Copyright (c) 2016 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -550,7 +550,10 @@ class IndexAttributes(object): return u'' data = actx.data if type(data) != unicode: - data = data.decode('UTF-8') + try: + data = data.decode('UTF-8') + except UnicodeDecodeError: + data = data.decode('ISO8859-15') return data def xx_text(self):