Skip to content

Commit 745db43

Browse files
committed
Unicode + string concatenation bug in output bufffer fixed
Thanks to Mark Florisson for the patch. committer: Bob Farrell <robertanthonyfarrell@gmail.com>
1 parent 403343d commit 745db43

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎CHANGELOG‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ stdout or not on exit.
1212
Piping something to bpython made it lock up as stdin was not the keyboard -
1313
bpython just executes stdin and exits instead of trying to do something clever.
1414

15+
Mark Florisson (eggy) gave me a patch that stops weird breakage when unicode
16+
objects get added into the output buffer - they now get encoded into the output
17+
encoding.
18+
1519
v0.7.1
1620
======
1721
Added support for a history file, defaults to ~/.pythonhist and 100 lines but

‎bpython/cli.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,9 @@ def write(self, s):
950950
else:
951951
t = s
952952

953+
if isinstance(t, unicode):
954+
t = t.encode(sys.__stdout__.encoding)
955+
953956
if not self.stdout_hist:
954957
self.stdout_hist = t
955958
else:
@@ -982,6 +985,8 @@ def echo(self, s, redraw=True):
982985
uses the formatting method as defined in formatter.py to parse the
983986
srings. It won't update the screen if it's reevaluating the code (as it
984987
does with undo)."""
988+
if isinstance(s, unicode):
989+
s = s.encode(sys.__stdout__.encoding)
985990

986991
a = curses.color_pair(0)
987992
if '\x01' in s:

0 commit comments

Comments
 (0)