bugfix: if fontname is bytes then skip (#43)
parent
6cc4abbaa8
commit
61d423d81c
|
@ -275,6 +275,8 @@ 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):
|
||||||
|
return ''
|
||||||
x = x.replace('&', '&').replace('>', '>').replace('<', '<').replace('"', '"')
|
x = x.replace('&', '&').replace('>', '>').replace('<', '<').replace('"', '"')
|
||||||
if codec:
|
if codec:
|
||||||
x = x.encode(codec, 'xmlcharrefreplace')
|
x = x.encode(codec, 'xmlcharrefreplace')
|
||||||
|
|
Loading…
Reference in New Issue