encoding problems (X and X)
Walter Dörwald
walter at livinglogic.de
Fri Mar 24 10:50:18 EST 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)
try:
v.append(unichr(decoding_map[key]))
except KeyError:
v.append(u"?")
return (u"".join(v), uerr.end)
codecs.register_error('replacelatscii', latscii_error)
Bye,
Walter Dörwald
More information about the Python-list
mailing list