Ack.
On 12/05/2012 10:55 AM, Vratislav Podzimek wrote:
Also add such case to the handle_unicode unittest.
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
meh/dump.py | 4 ++++
tests/handle_unicode.py | 1 +
2 files changed, 5 insertions(+)
diff --git a/meh/dump.py b/meh/dump.py
index 6537990..81751d2 100644
--- a/meh/dump.py
+++ b/meh/dump.py
@@ -352,10 +352,14 @@ class ExceptionDump(object):
first = 0
if type(k) == types.StringType:
ret += "'%s': " % (k,)
+ elif type(k) == types.UnicodeType:
+ ret += "'%s': " % k.encode("utf-8")
else:
ret += "%s: " % (k,)
if __isSimpleType(v):
+ if type(v) == types.UnicodeType:
+ v = v.encode("utf-8")
ret += "%s" % (v,)
else:
ret += self._dumpClass(v, level + 1, parentkey = curkey,
skipList=skipList)
diff --git a/tests/handle_unicode.py b/tests/handle_unicode.py
index 6ae67d7..65fc297 100644
--- a/tests/handle_unicode.py
+++ b/tests/handle_unicode.py
@@ -14,6 +14,7 @@ class UnicodeExample(object):
self.ascii_str = ASCII_STR
self.unicode_str = UNICODE_STR
self.encoded_str = self.unicode_str.encode("utf-8")
+ self.unicode_dict = { "úú" : "áá" }
class HandleUnicode_TestCase(BaseTestCase):
def setUp(self):