Skip to content

Commit 2767250

Browse files
committed
BUG: closes #777, high ascii cannot be displayed in console
1 parent c73a20e commit 2767250

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pandas/core/common.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,10 @@ def _asarray_tuplesafe(values, dtype=None):
502502

503503
def _stringify(col):
504504
# unicode workaround
505-
return unicode(col)
505+
try:
506+
return unicode(col)
507+
except UnicodeError:
508+
return console_encode(col)
506509

507510
def _maybe_make_list(obj):
508511
if obj is not None and not isinstance(obj, (tuple, list)):

pandas/tests/test_format.py

+5
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ def test_to_string_unicode_two(self):
8383
buf = StringIO()
8484
dm.to_string(buf)
8585

86+
def test_to_string_unicode_three(self):
87+
dm = DataFrame(['\xc2'])
88+
buf = StringIO()
89+
dm.to_string(buf)
90+
8691
def test_to_string_with_formatters_unicode(self):
8792
df = DataFrame({u'c/\u03c3':[1,2,3]})
8893
result = df.to_string(formatters={u'c/\u03c3': lambda x: '%s' % x})

0 commit comments

Comments
 (0)