Convert weird unicode string characters to string:
import unicodedata
unicodedata.normalize('NFKD',unicode_string).encode('ascii','ignore')
Django module for helping convert things to ascii strings:
from django.utils.encoding import smart_str
smart_str('weird string goes here')
Another hack for removing unicode errors:
unicode('my weird string', errors='ignore')
http://docs.python.org/howto/unicode.html#the-unicode-type
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment