Python and unicode
Martin v. Loewis
martin at v.loewis.de
Sun Sep 19 16:01:00 EDT 2010
> One more thing, is there some mechanism to avoid writing all the time
> 'something'.decode('utf-8')?
Yes, use u'something' instead (i.e. put the letter u before the literal,
to make it a unicode literal). Since Python 2.6, you can also put
from __future__ import unicode_literals
at the top of the file to make all string literals Unicode objects.
Since Python 3.0, this is the default (i.e. all string literals
*are* unicode objects).
Regards,
Martin
More information about the Python-list
mailing list