From aa1f9e9656d12f5ae50a511e5cb268a9863b77cb Mon Sep 17 00:00:00 2001 From: Louis Date: Fri, 4 Jul 2014 12:26:06 +0200 Subject: [PATCH] Trying to solve encoding problems #50 --- patacrep/authors.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/patacrep/authors.py b/patacrep/authors.py index 134bffd1..9f8911f9 100644 --- a/patacrep/authors.py +++ b/patacrep/authors.py @@ -21,8 +21,11 @@ def to_utf8(string): elif type(string) is str: return string.decode('iso-8859-1').encode('utf-8') else: - LOGGER.warning("Ignoring a word I can not decode...") - return None + try: + return string.encode('utf-8') + except: + LOGGER.warning("Ignoring a word I can not decode...") + return "" def compile_authwords(authwords): """Convert strings of authwords to compiled regular expressions.