Skip to content

Commit

Permalink
handle unicode strings properly (tartley#36, Azure/azure-cli#6408)
Browse files Browse the repository at this point in the history
  • Loading branch information
jodok committed Jun 16, 2018
1 parent 2b7f7a7 commit 49f2f54
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion colorama/ansitowin32.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ def write_and_convert(self, text):

def write_plain_text(self, text, start, end):
if start < end:
self.wrapped.write(text[start:end])
if isinstance(text, unicode):
self.wrapped.write(text[start:end].encode('ascii', 'ignore'))
else:
self.wrapped.write(text[start:end])
self.wrapped.flush()


Expand Down

0 comments on commit 49f2f54

Please sign in to comment.