encoding problems (X and X)

Walter Dörwald walter at livinglogic.de
Fri Mar 24 16:50:18 CET 2006

Duncan Booth wrote:

> [...]
> Unfortunately, just as I finished writing this I discovered that the 
> latscii module isn't as robust as I thought, it blows up on consecutive 
> accented characters. 
>  :(

Replace the error handler with this (untested) and it should work with
consecutive accented characters:

def latscii_error( uerr ):
	v = []
	for c in uerr.object[uerr.start:uerr.end]
		key = ord(c)
		except KeyError:
	return (u"".join(v), uerr.end)
codecs.register_error('replacelatscii', latscii_error)

   Walter Dörwald

More information about the Python-list mailing list