[Zope3-dev] Re: Zope 3 DAV tests on Win32...
Fred L. Drake, Jr.
fred@zope.com
Thu, 22 May 2003 10:33:17 -0400
I wrote:
> xml.dom.minidom is available in both PyXML and Python 2.2, but the
> PyXML version has advanced to include output encoding control (the
> 'utf-8' parameter used here).
Ok, I've taken a look at this, and here's my recommended solution:
- continue to serialize the XML document using toxml(), but don't pass
an encoding; this will cause it to return a Unicode string
- encode the resulting string to UTF-8
So the conversion should look like this:
body = response.toxml().encode('utf-8')
This will be more flexible in the version requirements and be slightly
more efficient computationally.
-Fred
--
Fred L. Drake, Jr. <fred at zope.com>
PythonLabs at Zope Corporation