Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

escaping only double quotes


  • From: iapain at gmail.com (iapain)
  • Subject: escaping only double quotes
  • Date: Fri, 31 Aug 2007 16:43:45 -0000

You could write a simple escape function.

def escape(html):
    "Return the given TEXT with ampersands, quotes and carets
encoded."
    return html.replace('&', '&amp;').replace('<',
'&lt;').replace('>', '&gt;').replace('"', '&quot;').replace("'",
'&#39;')