DurumDara wrote:

> Have the python standard mod. lib. a html/xml encoder functions/procedures ?

you can use

    cgi.escape(s) # escapes < > &

for CDATA sections, and

    cgi.escape(s, True) # escapes < > & "

for attributes.

to output ASCII, use

    cgi.escape(s).encode("ascii", "xmlcharrefreplace")
    cgi.escape(s, True).encode("ascii", "xmlcharrefreplace")

>             if b<32 or b>127 or c in ['<','>','"',';','&','@','%','#']:
>                 c="&#%03d;"%b

that's a rather odd set of reserved characters...

</F>



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

Reply via email to