Unicode error handler

Rares Vernica rvernica at gmail.com
Fri Jan 26 14:54:53 EST 2007


Hi,

Does anyone know of any Unicode encode/decode error handler that does a 
better replace job than the default replace error handler?

For example I have an iso-8859-1 string that has an 'e' with an accent 
(you know, the French 'e's). When I use s.encode('ascii', 'replace') the 
'e' will be replaced with '?'. I would prefer to be replaced with an 'e' 
even if I know it is not 100% correct.

If only this letter would be the problem I would do it manually, but 
there is an entire set of letters that need to be replaced with their 
closest ascii letter.

Is there an encode/decode error handler that can replace all the 
not-ascii letters from iso-8859-1 with their closest ascii letter?

Thanks a lot,
Ray




More information about the Python-list mailing list