Commits

Benjamin Peterson committed c1d968d

decode unicode literals in py2 properly, so escapes work (issue #2)

  • Participants
  • Parent commits 3a6cc32

Comments (0)

Files changed (3)

 Development version
 -------------------
 
+- Issue #2: u() on Python 2.x now resolves unicode escapes.
+
 - Expose an API for adding mappings to six.moves.
 
 
     def b(s):
         return s
     def u(s):
-        return unicode(s)
+        return unicode(s, "unicode_escape")
     import StringIO
     StringIO = BytesIO = StringIO.StringIO
 _add_doc(b, """Byte literal""")
         assert s == "hi"
 
 
+def test_u_escapes():
+    s = six.u("\u1234")
+    assert len(s) == 1
+
+
 def test_StringIO():
     fp = six.StringIO()
     fp.write(six.u("hello"))