[ python-Bugs-1472827 ] xml.sax.saxutils.XMLGenerator mangles \r\n\t in attributes

SourceForge.net noreply at sourceforge.net
Fri Jun 9 15:16:17 CEST 2006


Bugs item #1472827, was opened at 2006-04-19 04:29
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1472827&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: XML
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Mikhail Gusarov (gusarov)
Assigned to: Nobody/Anonymous (nobody)
Summary: xml.sax.saxutils.XMLGenerator mangles \r\n\t in attributes

Initial Comment:
xml.sax.saxutils.XMLGenerator does not escape \r, \n,
\t symbols when they are present in the attribute:

startElement("name", {"attrib": "value\nvalue"}) will
result in

<name attrib="value
value">

which will be normalized by XML parser to <name
attrib="value value">

According to the XML specs, to preserve this symbols in
the attribute values, they should be replaced with \xD;
\xA; \x9;

Trivial fix is to replace those characters in
xml.sax.saxutils.writeattr


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

>Comment By: A.M. Kuchling (akuchling)
Date: 2006-06-09 09:16

Message:
Logged In: YES 
user_id=11375

Fixed in trunk in rev. 46773; thanks for reporting this!

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

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


More information about the Python-bugs-list mailing list