valide html - Encoding/Decoding

R

rabby

hello world!
how to get the string "/ + ( ) + \ + [ ] + : + äöü" converted into
valide html.
"...".decode("html") does not run :(
thank you for help
 
D

Dennis Lee Bieber

hello world!
how to get the string "/ + ( ) + \ + [ ] + : + äöü" converted into
valide html.
"...".decode("html") does not run :(
thank you for help

Uhmm... You don't show enough for me to know what type of "decode"
you are trying... But HTML is not a unicode character set to my
knowledge, and that's the only place I've recently seen encode/decode
methods...

You probably want to examine the module

htmlentitydefs

--
 
G

gene tani

rabby said:
hello world!
how to get the string "/ + ( ) + \ + [ ] + : + äöü" converted into
valide html.
"...".decode("html") does not run :(
thank you for help

the a-umlaut <=> ä and other translations are in htmlentitydefs,
like Dennis said.

cgi.escape will give you &lt; &amp; &quote; etc, xml.sax.saxutils has
parallel functions
http://docs.python.org/lib/module-xml.sax.saxutils.html

of the RFC 1738 encodings you need to do for chars in URLs, i believe
"~" is the only one you commonly have to worry about so rewrite as
"%7E" manually...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top