xmlentities

O

Ola Natvig

Hi all

Does anyone know a good library for transfering non standard characters
to enity characters in html. I want characters like < and > to be
transformed to &lt; and &gt;. And the norwegian ø to &oslash;

ola
 
D

Duncan Booth

Ola said:
Does anyone know a good library for transfering non standard characters
to enity characters in html. I want characters like < and > to be
transformed to &lt; and &gt;. And the norwegian ø to &oslash;

You could use cgi.escape to handle &, <, and > and then use error handling
'&lt;ø&gt;'


If you really want named entities, then have a look at
lib/test/test_codeccallbacks which has a test called
test_xmlcharnamereplace that registers another codec error handler
'test.xmlcharnamereplace'. I think you could probably extract that and use
it as above.
 

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
474,219
Messages
2,571,117
Members
47,730
Latest member
scavoli

Latest Threads

Top