1059
Comment:
|
1037
reduce chatter
|
Deletions are marked like this. | Additions are marked like this. |
Line 35: | Line 35: |
LionKimbro: Is there anything in the standard library for going the other way? Is there something where you can give it "&" and get back "&"? Perhaps in the XML libraries? I looked, but did not see anything. DOM, SAX- wouldn't be there. Not exactly XML-RPC either. Anyone know? [[Date(2005-06-10T16:35:16Z)]] FredDrake: Do you want this for XML or HTML? The responses are different. |
LionKimbro: Is there anything in the standard library for going the other way? Is there something where you can give it "&" and get back "&"? Perhaps in the XML libraries? I looked, but did not see anything. DOM, SAX- wouldn't be there. Not exactly XML-RPC either. Anyone know? (Answer needed for XML; HTML would be nice as well.) [[Date(2005-06-10T16:35:16Z)]] |
Escaping HTML
The cgi module that comes with Python has an escape function:
However, it doesn't escape characters beyond &, <, and >.
Here's a small snippet that will let you escape those as well:
Discussion
LionKimbro: Is there anything in the standard library for going the other way? Is there something where you can give it "&" and get back "&"? Perhaps in the XML libraries? I looked, but did not see anything. DOM, SAX- wouldn't be there. Not exactly XML-RPC either. Anyone know? (Answer needed for XML; HTML would be nice as well.) Date(2005-06-10T16:35:16Z)