mirror of
https://github.com/gryf/ebook-converter.git
synced 2025-12-18 13:10:17 +01:00
Moving dependent function my_unichar into entity_to_unicode function
This commit is contained in:
@@ -107,13 +107,6 @@ def walk(dir):
|
||||
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',
|
||||
result_exceptions={}):
|
||||
"""
|
||||
@@ -134,6 +127,12 @@ def entity_to_unicode(match, exceptions=[], encoding='cp1252',
|
||||
actual entities.
|
||||
"""
|
||||
|
||||
def my_unichr(num):
|
||||
try:
|
||||
return chr(num)
|
||||
except (ValueError, OverflowError):
|
||||
return '?'
|
||||
|
||||
def check(ch):
|
||||
return result_exceptions.get(ch, ch)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user