From e673e26c5373d6f931136e931ab8d69ffa22dfaa Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 26 Dec 2011 15:43:04 +0100 Subject: [PATCH] fix unicode issues --- pandora/annotation/models.py | 5 ++--- pandora/annotation/utils.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pandora/annotation/models.py b/pandora/annotation/models.py index 6383c3d7..55cb04f4 100644 --- a/pandora/annotation/models.py +++ b/pandora/annotation/models.py @@ -61,10 +61,9 @@ class Annotation(models.Model): set_public_id = not self.id or not self.public_id layer = self.get_layer() if self.value: - self.value = utils.cleanup_value(self.value, self.layer['type']) + self.value = utils.cleanup_value(self.value, layer['type']) self.findvalue = ox.stripTags(self.value).strip() - sortvalue = self.findvalue - sortvalue = sort_string(sortvalue) + sortvalue = sort_string(self.findvalue) if sortvalue: self.sortvalue = sortvalue[:1000] else: diff --git a/pandora/annotation/utils.py b/pandora/annotation/utils.py index 95328d7a..b7a3980f 100644 --- a/pandora/annotation/utils.py +++ b/pandora/annotation/utils.py @@ -14,5 +14,5 @@ def cleanup_value(value, layer_type): return value def sanitize_fragment(html): - return html5lib.parseFragment(html).toxml() + return html5lib.parseFragment(html).toxml().decode('utf-8')