[XML-SIG] using PyXML on a string

"Martin v. Löwis" martin@v.loewis.de
Mon, 26 May 2003 23:26:50 +0200


Paul Tremblay wrote:

> This is from my code:
> 
> 
>     file = cStringIO.StringIO(u'<doc>\u00f6data</doc>')   
>     parser_obj.parse(file)             
> 
> The result is:
> 
> <doc>data</doc><doc>ödata</doc>
> 
> Am I passing <type 'string'> or <type 'unicode'>?

You are passing a Unicode string. However, cStringIO only
supports byte strings, so the system default encoding is
applied to convert the Unicode string to a byte string.

Regards,
Martin