[Zope3-dev] i18n, unicode, and string encoding

Guido van Rossum guido@python.org
Mon, 14 Apr 2003 13:14:51 -0400


> I think  the string object should store its encoding  in an attribute. 
> Why ? Given a string I would like to know what its encoding is . How can 
> I do that now ?

You could subclass the str type, or you can create a class that
contains a string and an encoding name (maybe subclassing UserString).

But I challenge you and ask, why do you want to know its encoding?
You shouldn't be carrying around encoded strings.  Instead, you should
decode strings into Unicode.

--Guido van Rossum (home page: http://www.python.org/~guido/)