[lxml-dev] html encoding

Daniel Jirku nepi at gmx.ch
Thu Dec 4 12:46:34 CET 2008


hi...

My problem is i suppose well known, but i couldnt find any soultion through my searches...

I have a regular html link with ? and an &. When i print the variable in pyhton, it looks fine... (like: http://www.somelink.com/site.html?param1=test&param2=hello), BUT when i add it to my root xml element with:
adId1 = etree.SubElement(tagAd, "originalAdUrl")
adId1.text = adUrl

and then later write the xml to a file with this:
toStringValue = etree.tostring(xmlTagRoot, encoding="utf-8", method="xml", xml_declaration=True, pretty_print=True)
...

the tag has as its value the link with an & instead of & !!
How can i use the correct signs for persistant storage in a xml file...?

thank you very much..

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger


More information about the lxml-dev mailing list