[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: ... Ah, I answered you on the Italian NG before seeing you had also posted the same request here. What I proposed there was (untested):
import codecs _rimedi = { u'\x2019': "'" } def rimedia(exc): if isinstance(exc, (UnicodeEncodeError, UnicodeTranslateError)): erore = exc.object[exc.start:exc.end] if len(erore)==1 and erore in _rimedi: return _rimedi[erore] raise exc codecs.register_error('rimedia', rimedia) outf = codecs.open('filename.txt', 'w', 'iso-8859-15', errors='rimedia') Alex -- http://mail.python.org/mailman/listinfo/python-list