| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f9c8c8e commit b772e1b
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,7 @@ | |||
| 9 | 9 | import textwrap | |
| 10 | 10 | ||
| 11 | 11 | from bpython.test import unittest, TEST_CONFIG | |
| 12 | + from bpython.config import getpreferredencoding | ||
| 12 | 13 | ||
| 13 | 14 | try: | |
| 14 | 15 | from twisted.internet import reactor | |
@@ -57,6 +58,7 @@ def run_bpython(self, input): | |||
| 57 | 58 | Returns bpython's output. | |
| 58 | 59 | """ | |
| 59 | 60 | result = Deferred() | |
| 61 | + encoding = getpreferredencoding() | ||
| 60 | 62 | ||
| 61 | 63 | class Protocol(ProcessProtocol): | |
| 62 | 64 | STATES = (SEND_INPUT, COLLECT) = range(2) | |
@@ -68,7 +70,7 @@ def __init__(self): | |||
| 68 | 70 | self.state = next(self.states) | |
| 69 | 71 | ||
| 70 | 72 | def outReceived(self, data): | |
| 71 | - self.data += data | ||
| 73 | + self.data += data.decode(encoding) | ||
| 72 | 74 | if self.delayed_call is not None: | |
| 73 | 75 | self.delayed_call.cancel() | |
| 74 | 76 | self.delayed_call = reactor.callLater(0.5, self.next) | |
@@ -79,7 +81,7 @@ def next(self): | |||
| 79 | 81 | index = self.data.find(">>> ") | |
| 80 | 82 | if index >= 0: | |
| 81 | 83 | self.data = self.data[index + 4 :] | |
| 82 | - self.transport.write(input) | ||
| 84 | + self.transport.write(input.encode(encoding)) | ||
| 83 | 85 | self.state = next(self.states) | |
| 84 | 86 | else: | |
| 85 | 87 | self.transport.closeStdin() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments