diff --git a/IPython/html/services/notebooks/tests/test_notebooks_api.py b/IPython/html/services/notebooks/tests/test_notebooks_api.py
index 33238bc60..ceee22c48 100644
--- a/IPython/html/services/notebooks/tests/test_notebooks_api.py
+++ b/IPython/html/services/notebooks/tests/test_notebooks_api.py
@@ -108,7 +108,8 @@ class APITest(NotebookTestBase):
for d, name in self.dirs_nbs:
d = d.replace('/', os.sep)
- with io.open(pjoin(nbdir, d, '%s.ipynb' % name), 'w') as f:
+ with io.open(pjoin(nbdir, d, '%s.ipynb' % name), 'w',
+ encoding='utf-8') as f:
nb = new_notebook(name=name)
write(nb, f, format='ipynb')
diff --git a/IPython/html/services/sessions/tests/test_sessions_api.py b/IPython/html/services/sessions/tests/test_sessions_api.py
index 0d31fa766..896f4cdaf 100644
--- a/IPython/html/services/sessions/tests/test_sessions_api.py
+++ b/IPython/html/services/sessions/tests/test_sessions_api.py
@@ -59,7 +59,8 @@ class SessionAPITest(NotebookTestBase):
if e.errno != errno.EEXIST:
raise
- with io.open(pjoin(nbdir, 'foo', 'nb1.ipynb'), 'w') as f:
+ with io.open(pjoin(nbdir, 'foo', 'nb1.ipynb'), 'w',
+ encoding='utf-8') as f:
nb = new_notebook(name='nb1')
write(nb, f, format='ipynb')