This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: xml.sax.saxutils.XMLGenerator mangles \r\n\t in attributes
Type: Stage:
Components: XML Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, gusarov
Priority: normal Keywords:

Created on 2006-04-19 08:29 by gusarov, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg28302 - (view) Author: Mikhail Gusarov (gusarov) Date: 2006-04-19 08:29
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
msg28303 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2006-06-09 13:16
Logged In: YES 
user_id=11375

Fixed in trunk in rev. 46773; thanks for reporting this!
msg28304 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2006-06-09 14:00
Logged In: YES 
user_id=11375

Fixed on release24-maint in rev. 46777.
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43247
2006-04-19 08:29:37gusarovcreate