Martin v. Loewis
Fri, 10 Aug 2001 21:18:55 +0200
> I thought, "Gee, what if I force this to use StringIO instead of
> Guess what? It worked without manually encoding the string as 'utf-8'.
> Does that mean the problem is in cStringIO? I guess I'm still not clear on
> what the exact problem is. Is it that cStringIO only accepts ... what?
I'd say it doesn't *really* work. Yes, cStringIO insists on getting
byte strings; it won't accept default-conversion converted Unicode
strings. This is a known limitation.
Even when you use StringIO.StringIO, it still will use the pyexpat
reader, which will require byte strings; the Unicode string in the
StringIO object will then get default-converted. So if you have any
non-ASCII characters in your Unicode string, you'll get a Unicode
error with your approach.