Gracefully handle non-ASCII disclosure files

- Legacy-Id: 1694
This commit is contained in:
Pasi Eronen 2009-09-22 19:13:51 +00:00
parent e982746d0f
commit 2551d315fe

View file

@ -1,5 +1,6 @@
# Copyright The IETF Trust 2007, All Rights Reserved
import codecs
import re
import os.path
import django.utils.html
@ -57,7 +58,7 @@ def patent_file_search(url, q):
#print "*** Checking file", fpath
if os.path.exists(fpath):
#print "*** Found file", fpath
file = open(fpath)
file = codecs.open(fpath, mode='r', encoding='utf-8', errors='replace')
text = file.read()
file.close
return q in text