fixes to arguments for _encode_char

This commit is contained in:
Michael Billington 2016-09-11 21:08:04 +10:00
parent 83f926758c
commit 7a7ea23628
1 changed files with 2 additions and 2 deletions

View File

@ -126,7 +126,7 @@ class Encoder(object):
is_encodable = char in available_map is_encodable = char in available_map
return is_ascii or is_encodable return is_ascii or is_encodable
def _encode_char(self, char, charmap): def _encode_char(self, char, charmap, defaultchar):
""" Encode a single character with the given encoding map """ Encode a single character with the given encoding map
:param char: char to encode :param char: char to encode
@ -136,7 +136,7 @@ class Encoder(object):
return ord(char) return ord(char)
if char in charmap: if char in charmap:
return charmap[char] return charmap[char]
return ord('?') return ord(defaultchar)
def encode(self, text, encoding, defaultchar='?'): def encode(self, text, encoding, defaultchar='?'):
""" Encode text under the given encoding """ Encode text under the given encoding