In python 2, they both inherit from basestring
but they are not of the same type, one is unicode
and the other str
. So not comparable and not the same.
Unless you are using python 3 in which strings are unicode by default, the following is true:
u'Used Car for Sale \xa0\xa0 - \xa0' == 'Used Car for Sale \xa0\xa0 - \xa0'
but the following is not:
u'Used Car for Sale \xa0\xa0 - \xa0' == 'Used Car for Sale \xa0\xa0 - \xa0'.encode('utf-8')
since the encoded one's type is bytes, so again not comparable.
I would say how you store it depends on a number of reasons. Maybe you want to preserve the text exactly as you received it or you want to clean it up before displaying it somewhere where these encodings don't matter or add noise, i.e. replace \xa0
with spaces etc.
Also, check out this excellent answer as it explains in detail their difference - maybe that helps you reach a decision: Python str vs unicode types