[Python-3000] str/unicode tests: pyexpat.c and read(n)

Fred L. Drake, Jr. fdrake at acm.org
Sat Jul 21 19:36:59 CEST 2007


On Saturday 21 July 2007, James Y Knight wrote:
 > Well...there's many reasons why it is useful to be able to parse an
 > already-decoded unicode stream into XML, and to serialize XML into a
 > unicode string. For example, if combining into a larger unicode
 > document, or parsing from a literal string in the source code.

Yes, but that doesn't mean it's the XML parser's job to take multiple input 
types.  It could easily be supported by creating a wrapper object that 
converts unicode to bytes objects, so the underlying C parser still gets 
bytes.  Such a wrapper could easily be part of xml.parsers.expat if desired, 
but I'd like to avoid adding lots of stuff to the pyexpat C code.

Avoiding complexifying the C code is a good thing.  ;-)


  -Fred

-- 
Fred L. Drake, Jr.   <fdrake at acm.org>


More information about the Python-3000 mailing list