I'll try to explain my problem with code.
The problem is the output

msg = u"Södertälje & Borås" # latin1 unicode string with a &

from elementtree.SimpleXMLWriter import XMLWriter
from cStringIO import StringIO
out = StringIO()
w = XMLWriter(out)
body = w.start("body")
w.element("text", msg)
w.close(body)
return out.getvalue()

Here's the output I get:
<body><text>S&#246;dert&#228;lje &#38;amp; Bor&#229;s</text></body>
Here's what I would want and expect:
<body><text>S&#246;dert&#228;lje &amp; Bor&#229;s</text></body>

Notice that & is converted to &#38;amp; when it should be &amp; or &38;
only.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to