htmlentities, htmlspecialchars

Gandalf gandalf at geochemsource.com
Thu Feb 26 05:17:24 EST 2004


>
>
>>Hi all! I'm writting a web application using IIS and Python. I would
>>like to have the Python equvalient of the PHP functions
>>'htmlentities'
>>and 'htmlspecialchars'. E.g. to convert
>>
>>  a'   >>>>  aacute;
>>  ő  >>>>    otilde;
>>
>>and the others. I looked for them in many libraries (urllib, htmllib,
>>urlparse etc.) but I could only find the 'urlencode'
>>function. I could
>>not find anything on google  ('python htmlentities
>>equvalent'). Please
>>help me find it out. Thanks in advance.
>>    
>>
>
>http://www.python.org/doc/current/lib/module-htmlentitydefs.html is used by htmllib. Try codepoint2name (new in 2.3).
>
I found the perfect solution.  Python equivalent of PHP's htmlentities 
or htmlspecialchars is the escape function from the cgi module.

Keywords: Python, PHP, htmlentities, htmlspecialchars, equivalent, 
escape, cgi

Adding another object to the Google universe. :-)

Best,

   G






More information about the Python-list mailing list