Hopefully. Python's unicode history is a mess.
---
python/t/130-special.py | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/python/t/130-special.py b/python/t/130-special.py
index 7adb9d5..f0ac008 100755
--- a/python/t/130-special.py
+++ b/python/t/130-special.py
@@ -1,4 +1,13 @@
# coding: utf-8
+#
http://stackoverflow.com/questions/6625782/unicode-literals-that-work-in-...
+import sys
+if sys.version < '3':
+ import codecs
+ def u(x):
+ return codecs.unicode_escape_decode(x)[0]
+else:
+ def u(x):
+ return x
import os
import hivex
@@ -13,16 +22,20 @@ assert h
root = h.root ()
assert root
-ns = [ n for n in h.node_children (root) if h.node_name(n) == u"abcd_äöüß" ]
+# "abcd_äöüß"
+ns = [ n for n in h.node_children (root) if h.node_name(n) ==
u("abcd_\u00e4\u00f6\u00fc\u00df") ]
assert len (ns) == 1
-vs = [ v for v in h.node_values (ns[0]) if h.value_key(v) == u"abcd_äöüß" ]
+# "abcd_äöüß"
+vs = [ v for v in h.node_values (ns[0]) if h.value_key(v) ==
u("abcd_\u00e4\u00f6\u00fc\u00df") ]
assert len (vs) == 1
-ns = [ n for n in h.node_children (root) if h.node_name(n) == u"zero\0key" ]
+ns = [ n for n in h.node_children (root) if h.node_name(n) == u("zero\0key") ]
assert len (ns) == 1
-vs = [ v for v in h.node_values (ns[0]) if h.value_key(v) == u"zero\0val" ]
+vs = [ v for v in h.node_values (ns[0]) if h.value_key(v) == u("zero\0val") ]
assert len (vs) == 1
-ns = [ n for n in h.node_children (root) if h.node_name(n) == u"weird™" ]
+# "weird™"
+ns = [ n for n in h.node_children (root) if h.node_name(n) == u("weird\u2122")
]
assert len (ns) == 1
-vs = [ v for v in h.node_values (ns[0]) if h.value_key(v) == u"symbols $£₤₧€"
]
+# "symbols $£₤₧€"
+vs = [ v for v in h.node_values (ns[0]) if h.value_key(v) == u("symbols
\u0024\u00a3\u20a4\u20a7\u20ac") ]
assert len (vs) == 1
--
1.8.5.2