diff --git a/IPython/nbformat/v4/convert.py b/IPython/nbformat/v4/convert.py index 24bf53e..0abcf66 100644 --- a/IPython/nbformat/v4/convert.py +++ b/IPython/nbformat/v4/convert.py @@ -91,7 +91,7 @@ def upgrade_cell(cell): elif cell.cell_type == 'heading': cell.cell_type = 'markdown' level = cell.pop('level', 1) - cell.source = '{hashes} {single_line}'.format( + cell.source = u'{hashes} {single_line}'.format( hashes='#' * level, single_line = ' '.join(cell.get('source', '').splitlines()), ) diff --git a/IPython/nbformat/v4/tests/test_convert.py b/IPython/nbformat/v4/tests/test_convert.py index 4e9c0e5..dd8305c 100644 --- a/IPython/nbformat/v4/tests/test_convert.py +++ b/IPython/nbformat/v4/tests/test_convert.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import copy import nose.tools as nt @@ -33,6 +34,10 @@ def test_upgrade_heading(): v3h(source='foo\nbar\nmulti-line\n', level=4), v4m(source='#### foo bar multi-line'), ), + ( + v3h(source='unicode–conversion', level=4), + v4m(source=u'#### unicode–conversion'), + ), ]: upgraded = convert.upgrade_cell(v3cell) nt.assert_equal(upgraded, expected)