[Python-Dev] Ill-defined encoding for CP875?
Fredrik Lundh
fredrik@pythonware.com
Sat, 12 May 2001 14:25:43 +0200
tim wrote:
> If, e.g., you're *relying* on "the first" of a set of ambiguous reverse mappings
> winning the game, then iterating over decoding_map.items() in reverse sorted
> order would do the trick reliably.
reverse sorting makes sense to me. but the cp-files appear to be
machine generated, so patching that python file won't help.
> But I don't know whether the ambiguity in cp875 is a bug or an undocumented
> feature ...
a truly future-proof solution would be to specify exactly how to resolve
every many-to-one mapping, for every font having that problem. but
sorting them is clearly better than relying on implementation-dependent
behaviour...
(is Jython using exactly the same hashing and dictionary algorithms as
CPython? or does it work by accident also under Jython?)
Cheers /F