[PATCH] encoding: improve handling of buggy getpreferredencoding() on Mac OS X

Patrick Mézard pmezard at gmail.com
Sun Aug 15 11:54:15 CDT 2010


Le 14/08/10 01:31, Dan Villiom Podlaski Christiansen a écrit :
> # HG changeset patch
> # User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
> # Date 1281742254 -7200
> # Node ID ec4a47b5db217863cd175e1e0aea51e4d7c17444
> # Parent  22cef2ef536169892e9a9c4380b5f0f9c17dbf39
> encoding: improve handling of buggy getpreferredencoding() on Mac OS X
> 
> Prior to version 2.7, calling locale.getpreferredencoding() would
> always return 'mac-roman' on Mac OS X. Previously, this was handled by
> a call to locale.setlocale(). Unfortunately, Python 2.6.5 and older
> have a bug where isspace() would incorrectly report True for 0x85 and
> 0xa0 after such a call.
> 
> In order to fix this, we replace the previous _encodingfixup mapping
> to an _encodingfixers mapping. Rather than mapping encodings to their
> replacement, it maps them to a function returning the
> replacement. This allows us to provide an simplified implementation of
> getpreferredencoding() which extracts the expected encoding and
> restores the locale.
> 
> This fix is based on a patch originally submitted by Martijn Pieters
> as well as feedback from Brodie Rao.

In crew-stable: http://hg.intevation.org/mercurial/crew/rev/2be70ca17311

Thanks!

--
Patrick Mézard


More information about the Mercurial-devel mailing list