String is ASCII or UTF-8?

C. Benson Manica cbmanica at
Tue Mar 9 17:54:55 CET 2010

Hours of Googling has not helped me resolve a seemingly simple
question - Given a string s, how can I tell whether it's ascii (and
thus 1 byte per character) or UTF-8 (and two bytes per character)?
This is python 2.4.3, so I don't have getsizeof available to me.

More information about the Python-list mailing list