ISO Latin -> HTML conversion

ben at co.and.co ben at co.and.co
Sat Jul 8 13:12:13 EDT 2000


Danny Yee <danny at thrud.anatomy.usyd.edu.au> wrote:
> I need to convert text with ISO Latin characters to HTML, e.g.
> I want to map é to é and so forth.
> 
> I can do this by reading in a wopping big file
> 	('À', 'À'),
> 	('Á', 'Á'),
> 	('Â', 'Â'),
> 	('Ã', 'Ã'),
> 		.
> 		.
> 
> and then going
> 	for pair in fix_list:
> 		line = re.sub(pair[0], pair[1], line)
> as I read each line... but there has to be something quicker than that,
> surely.  Is there a fast way to do this?
 
Just reverse the dictionnary, to be found in htmlentitydefs.

Greeetings,
-- 
ben . de . rydt at pandora . be ------------------ your comments
http://users.pandora.be/bdr/ ------- inl. IPv6, Linux en Pandora




More information about the Python-list mailing list