def force_unicode(text, encoding='utf-8'):
  """
  
  @TODO encoding support
  """
  if text == None:
    return u''

  try:
    text = unicode(text, 'utf-8')
  except UnicodeDecodeError:
    text = unicode(text, 'latin1')
  except TypeError:
    text = unicode(text)
  return text
def force_unicode ( text , encoding = 'utf-8' ) : if text == None : return u'' try : text = unicode ( text , 'utf-8' ) except UnicodeDecodeError : text = unicode ( text , 'latin1' ) except TypeError : text = unicode ( text ) return text
@TODO encoding support