From: ayleph Date: Fri, 4 Dec 2015 07:02:02 +0000 (-0500) Subject: Fix issue 983 PDF UnicodeDecodeError X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e2b44bd7a7478792be47c98086f5c91d0da283e2;p=mediagoblin.git Fix issue 983 PDF UnicodeDecodeError Parse PDF lines as unicode to prevent UnicodeDecodeError when a non-ASCII character is encountered. --- diff --git a/mediagoblin/media_types/pdf/processing.py b/mediagoblin/media_types/pdf/processing.py index f6d10a5f..ac4bab6d 100644 --- a/mediagoblin/media_types/pdf/processing.py +++ b/mediagoblin/media_types/pdf/processing.py @@ -207,7 +207,7 @@ def pdf_info(original): _log.debug('pdfinfo could not read the pdf file.') raise BadMediaFail() - lines = [l.decode() for l in lines] + lines = [l.decode('utf-8', 'replace') for l in lines] info_dict = dict([[part.strip() for part in l.strip().split(':', 1)] for l in lines if ':' in l])