We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d1bc126 commit 7bbc4e0Copy full SHA for 7bbc4e0
pandas/core/common.py
@@ -844,7 +844,7 @@ def console_encode(value):
844
845
try:
846
import sys
847
- return value.encode(sys.stdin.encoding, 'replace')
+ return value.encode(sys.stdin.encoding or 'utf-8', 'replace')
848
except (AttributeError, TypeError):
849
return value.encode('ascii', 'replace')
850
pandas/tests/test_common.py
@@ -297,6 +297,13 @@ def test_2d_float32(self):
297
expected[:, [2, 4]] = np.nan
298
tm.assert_almost_equal(result, expected)
299
300
+ def test_console_encode(self):
301
+
302
+ # stub test
303
+ # need to mock-out sys.stdin.encoding=None for real test
304
+ result = com.console_encode(u"\u05d0")
305
+ assert not result == '?'
306
307
308
if __name__ == '__main__':
309
import nose
0 commit comments