$ python
Python 2.4.4 (#2, Apr 5 2007, 20:11:18)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import StringIO
>>> x = StringIO.StringIO(u"m\xf6p")
>>> import cStringIO
>>> x = cStringIO.StringIO(u"m\xf6p")
>>>
$ python2.5
Python 2.5 (release25-maint, Dec 9 2006, 14:35:53)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import StringIO
>>> x = StringIO.StringIO(u"m\xf6p")
>>> import cStringIO
>>> x = cStringIO.StringIO(u"m\xf6p")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 1: ordinal not in range(128)
>>>
The Problem: cStringIO is used by xml.sax's parseString()