@staticmethod<EOL><INDENT>def _encode_char(char, charmap, defaultchar):<DEDENT>
if ord(char) < <NUM_LIT>:<EOL><INDENT>return ord(char)<EOL><DEDENT>if char in charmap:<EOL><INDENT>return charmap[char]<EOL><DEDENT>return ord(defaultchar)<EOL>
Encode a single character with the given encoding map

        :param char: char to encode
        :param charmap: dictionary for mapping characters in this code page