Merge pull request #139 from gvmori/py2fontfix

FIX: Only check for bytes input to enc() in python3
Note - For python2, no checks have been put in  place
pull/157/head
Tata Ganesh 2018-06-10 16:51:23 +05:30 committed by GitHub
commit 653b4f33ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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('&', '&amp;').replace('>', '&gt;').replace('<', '&lt;').replace('"', '&quot;') x = x.replace('&', '&amp;').replace('>', '&gt;').replace('<', '&lt;').replace('"', '&quot;')
if codec: if codec: