Fix byte format() on Python 3.

This commit is contained in:
Michael Elsdörfer 2016-08-30 18:06:34 +02:00
parent c3e3ec5808
commit ddc93d7369
1 changed files with 3 additions and 4 deletions

View File

@ -211,10 +211,9 @@ class MagicEncode(object):
# is different, emit a change command. # is different, emit a change command.
if encoding != self.encoding: if encoding != self.encoding:
self.encoding = encoding self.encoding = encoding
self.driver._raw(b'{}{}'.format( self.driver._raw(
CODEPAGE_CHANGE, CODEPAGE_CHANGE +
six.int2byte(self.encoder.get_sequence(encoding)) six.int2byte(self.encoder.get_sequence(encoding)))
))
if text: if text:
self.driver._raw(CodePages.encode(text, encoding, errors="replace")) self.driver._raw(CodePages.encode(text, encoding, errors="replace"))