hello hugo,

we're using your tagging code developing our site (in Chinese), while
dealing with the tags containing Chinese characters, I found that these
charaters were removed by the following line of code in the tagging.py:

[code]
tagslugs=dict([(slugify(latin1_to_ascii(el.strip())), el.strip()) for
el in s.split(',') if el.strip()])
[/code]

so, it's impossible to get Chinese charaters work with the original
tagging code, here is a small patch which repr the tag to its hex
presentation before it is processed by latin1_to_ascii & slugify
methods:

Index: stuff/tagging/models/tagging.py
===================================================================
--- stuff/tagging/models/tagging.py     (revision 204)
+++ stuff/tagging/models/tagging.py     (working copy)
@@ -48,7 +48,7 @@
         from django.core.template.defaultfilters import slugify
         from stuff.latin1 import latin1_to_ascii
         from django.models.tagging import tags
-        tagslugs=dict([(slugify(latin1_to_ascii(el.strip())),
el.strip()) for el in s.split(',') if el.strip()])
+
tagslugs=dict([(slugify(latin1_to_ascii(el.strip().__repr__())),
el.strip()) for el in s.split(',') if el.strip()])
         return tags.get_tags_from_dict(tagslugs)

     def _module_get_tags_from_dict(tagslugs, create=True):

that solved the problem.

with this patch, the slug field of the tag which contains cjk
characters (or any other charaters that are not ascii) will be
converted to something like this:

xe8xafx84xe8xaexba

while the tag's name field remains what it is as the user's input :)

- Eric


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to