1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2025-12-18 21:20:17 +01:00

Moving dependent function my_unichar into entity_to_unicode function

This commit is contained in:
2020-09-30 20:22:20 +02:00
parent 97ddcd7be1
commit a5880b2445

View File

@@ -107,13 +107,6 @@ def walk(dir):
yield os.path.join(record[0], f) yield os.path.join(record[0], f)
def my_unichr(num):
try:
return chr(num)
except (ValueError, OverflowError):
return '?'
def entity_to_unicode(match, exceptions=[], encoding='cp1252', def entity_to_unicode(match, exceptions=[], encoding='cp1252',
result_exceptions={}): result_exceptions={}):
""" """
@@ -134,6 +127,12 @@ def entity_to_unicode(match, exceptions=[], encoding='cp1252',
actual entities. actual entities.
""" """
def my_unichr(num):
try:
return chr(num)
except (ValueError, OverflowError):
return '?'
def check(ch): def check(ch):
return result_exceptions.get(ch, ch) return result_exceptions.get(ch, ch)