indexing: gracefully fall back to ISO8859 if UTF-8 gives an error

This commit is contained in:
Helmut Merz 2016-10-26 16:20:44 +02:00
parent 5f78698e06
commit 6261831340

View file

@ -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:
try:
data = data.decode('UTF-8')
except UnicodeDecodeError:
data = data.decode('ISO8859-15')
return data
def xx_text(self):