[Python-bugs-list] [ python-Bugs-486527 ] xmlrpclib can produce ill-formed XML

noreply@sourceforge.net noreply@sourceforge.net
Wed, 28 Nov 2001 11:31:05 -0800


Bugs item #486527, was opened at 2001-11-28 09:03
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=486527&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: A.M. Kuchling (akuchling)
>Assigned to: A.M. Kuchling (akuchling)
Summary: xmlrpclib can produce ill-formed XML

Initial Comment:
I discovered this when a control character got into a 
string.

import xmlrpclib
data = xmlrpclib.dumps( (chr(17),) )
print data

The resulting XML output isn't well-formed, because 
chr(17) isn't a legal character.  The fix is 
conceptually simple -- just check for illegal 
characters in the dump_string() method -- but I'm not 
sure how to do this check efficiently.  Fredrik, 
would it be OK with you to use a regex?






----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2001-11-28 11:31

Message:
Logged In: YES 
user_id=11375

An xmlescape codec wouldn't help with this; it could turn 
chr(17) into , but that character is still illegal.
Fixing the docs seems the most reasonable thing to do;
I'll try to contribute a documentation patch.






----------------------------------------------------------------------

Comment By: M.-A. Lemburg (lemburg)
Date: 2001-11-28 11:10

Message:
Logged In: YES 
user_id=38388

I suppose a xmlescape codec would be a good addition to the
set of codecs in Python. Maybe for 2.3...

----------------------------------------------------------------------

Comment By: Fredrik Lundh (effbot)
Date: 2001-11-28 10:22

Message:
Logged In: YES 
user_id=38376

I ignored this on purpose: instead of forcing everyone to 
pay a (rather big) performance penalty, the application 
must make sure to use the right data type.  The 
documentation probably needs fixing, though...

</F>

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=486527&group_id=5470