fix unicode issues

This commit is contained in:
j 2011-12-26 15:43:04 +01:00
parent 926d9a352e
commit e673e26c53
2 changed files with 3 additions and 4 deletions

View file

@ -61,10 +61,9 @@ class Annotation(models.Model):
set_public_id = not self.id or not self.public_id set_public_id = not self.id or not self.public_id
layer = self.get_layer() layer = self.get_layer()
if self.value: 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() self.findvalue = ox.stripTags(self.value).strip()
sortvalue = self.findvalue sortvalue = sort_string(self.findvalue)
sortvalue = sort_string(sortvalue)
if sortvalue: if sortvalue:
self.sortvalue = sortvalue[:1000] self.sortvalue = sortvalue[:1000]
else: else:

View file

@ -14,5 +14,5 @@ def cleanup_value(value, layer_type):
return value return value
def sanitize_fragment(html): def sanitize_fragment(html):
return html5lib.parseFragment(html).toxml() return html5lib.parseFragment(html).toxml().decode('utf-8')