2.7/3.4 encoding corrected

pull/1/head
unknown 2014-09-04 10:31:33 +02:00
parent 58b8492783
commit 28c2a4e6ad
1 changed files with 1 additions and 1 deletions

View File

@ -18,7 +18,7 @@ from pdfminer.utils import isnumber
ESC_PAT = re.compile(r'[\000-\037&<>()"\042\047\134\177-\377]') ESC_PAT = re.compile(r'[\000-\037&<>()"\042\047\134\177-\377]')
def e(s): def e(s):
if isinstance(s,six.binary_type): if six.PY3 and isinstance(s,six.binary_type):
s=str(s,'latin-1') s=str(s,'latin-1')
return ESC_PAT.sub(lambda m:'&#%d;' % ord(m.group(0)), s) return ESC_PAT.sub(lambda m:'&#%d;' % ord(m.group(0)), s)