diff --git a/IPython/nbconvert/writers/stdout.py b/IPython/nbconvert/writers/stdout.py index d91fcee..b816425 100644 --- a/IPython/nbconvert/writers/stdout.py +++ b/IPython/nbconvert/writers/stdout.py @@ -13,6 +13,7 @@ Contains Stdout writer # Imports #----------------------------------------------------------------------------- +from IPython.utils import io from .base import WriterBase #----------------------------------------------------------------------------- @@ -30,5 +31,4 @@ class StdoutWriter(WriterBase): See base for more... """ - - print(output) + io.unicode_std_stream().write(output) diff --git a/IPython/nbconvert/writers/tests/test_stdout.py b/IPython/nbconvert/writers/tests/test_stdout.py index 4b9add0..58c4cea 100644 --- a/IPython/nbconvert/writers/tests/test_stdout.py +++ b/IPython/nbconvert/writers/tests/test_stdout.py @@ -1,3 +1,4 @@ +# coding: utf-8 """ Module with tests for stdout """ @@ -43,9 +44,11 @@ class TestStdout(TestsBase): # Create stdout writer, test output writer = StdoutWriter() - writer.write('a', {'b': 'c'}) + writer.write(u'a×', {'b': 'c'}) output = stream.getvalue() - self.fuzzy_compare(output, 'a') + if not PY3: + output = output.decode('utf-8') + self.fuzzy_compare(output, u'a×') # Revert stdout sys.stdout = stdout \ No newline at end of file