adjust order in _encode_char to prioritise ASCII; ' ' is used in the character list to flag characters with no known UTF-8 code, better not encode as these
This commit is contained in:
parent
9a65945fcd
commit
83f926758c
|
@ -132,10 +132,10 @@ class Encoder(object):
|
|||
:param char: char to encode
|
||||
:param charmap: dictionary for mapping characters in this code page
|
||||
"""
|
||||
if char in charmap:
|
||||
return charmap[char]
|
||||
if ord(char) < 128:
|
||||
return ord(char)
|
||||
if char in charmap:
|
||||
return charmap[char]
|
||||
return ord('?')
|
||||
|
||||
def encode(self, text, encoding, defaultchar='?'):
|
||||
|
|
Loading…
Reference in New Issue