Unicode error fix in manpage completion with python3

This commit is contained in:
Adam 2012-06-05 13:22:29 +02:00 committed by ridiculousfish
parent 85f808130d
commit 4e3acdcbdc

View File

@ -661,11 +661,14 @@ def parse_manpage_at_path(manpage_path, output_directory):
fd = gzip.open(manpage_path, 'r')
else:
fd = open(manpage_path, 'r')
try:
try: #Utf-8 python3
manpage = fd.read()
except: #Latin-1 python3
fd = open(manpage_path, 'r', encoding='latin-1')
manpage = fd.read()
except UnicodeDecodeError:
return
fd.close()
manpage = str(manpage)
# Get the "base" command, e.g. gcc.1.gz -> gcc