only check for bytes input to enc() in python3
In python2, isinstance("", bytes) is true, causing enc() to suppress any string input. This results in fontnames being lost when running pdf2txt.py in python2. As this check was not present in the original python2 version of pdfminer, restrict it to only check when running in python3.pull/139/head
parent
eddf861fbd
commit
335c25c045
|
@ -275,7 +275,7 @@ def decode_text(s):
|
||||||
# enc
|
# enc
|
||||||
def enc(x, codec='ascii'):
|
def enc(x, codec='ascii'):
|
||||||
"""Encodes a string for SGML/XML/HTML"""
|
"""Encodes a string for SGML/XML/HTML"""
|
||||||
if isinstance(x, bytes):
|
if six.PY3 and isinstance(x, bytes):
|
||||||
return ''
|
return ''
|
||||||
x = x.replace('&', '&').replace('>', '>').replace('<', '<').replace('"', '"')
|
x = x.replace('&', '&').replace('>', '>').replace('<', '<').replace('"', '"')
|
||||||
if codec:
|
if codec:
|
||||||
|
|
Loading…
Reference in New Issue