Files
twitterboard/twiderboard/encodingUtils.py
Julien Lengrand-Lambert ad473eee47 Creates special method to decode everything to unicode and pasrse text as unicode strings.
Has to reencode before saving to db and so.
Already decodes hashtags. Lets now decode tweets
2012-12-20 14:59:22 +01:00

16 lines
356 B
Python

# -*- coding: utf-8 -*-
class EncodingUtils():
def __init__(self):
pass
def to_unicode(self, obj, encoding='utf-8'):
"""
Returns an encoded string into unicode
"""
if isinstance(obj, basestring):
if not isinstance(obj, unicode):
obj = unicode(obj, encoding)
return obj