From 516b6450a425b09ee6e0c8fcab5772265d4ab551 2013-08-02 00:00:50
From: Jonathan Frederic <jdfreder@calpoly.edu>
Date: 2013-08-02 00:00:50
Subject: [PATCH] add_anchor always return unicode

---

diff --git a/IPython/nbconvert/filters/strings.py b/IPython/nbconvert/filters/strings.py
index fcf8af8..f9f67db 100755
--- a/IPython/nbconvert/filters/strings.py
+++ b/IPython/nbconvert/filters/strings.py
@@ -88,7 +88,7 @@ def add_anchor(html):
     # Known issue of Python3.x, ElementTree.tostring() returns a byte string
     # instead of a text string.  See issue http://bugs.python.org/issue10942
     # Workaround is to make sure the bytes are casted to a string.
-    return py3compat.bytes_to_str(ElementTree.tostring(h))
+    return py3compat.str_to_unicode(py3compat.bytes_to_str(ElementTree.tostring(h)))
 
 
 def strip_dollars(text):