Merge lp:~gz/bzr/filesystem_default_encoding_794353 into lp:bzr
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Jelmer Vernooij | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 6367 | ||||
Proposed branch: | lp:~gz/bzr/filesystem_default_encoding_794353 | ||||
Merge into: | lp:bzr | ||||
Diff against target: |
204 lines (+71/-16) 7 files modified
bzr (+4/-0) bzrlib/__init__.py (+42/-0) bzrlib/osutils.py (+2/-5) bzrlib/tests/blackbox/test_exceptions.py (+8/-0) bzrlib/tests/test_osutils.py (+3/-11) doc/en/release-notes/bzr-2.5.txt (+5/-0) doc/en/whats-new/whats-new-in-2.5.txt (+7/-0) |
||||
To merge this branch: | bzr merge lp:~gz/bzr/filesystem_default_encoding_794353 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Vincent Ladeuil | Approve | ||
Jelmer Vernooij (community) | code | Approve | |
Review via email: mp+85170@code.launchpad.net |
Commit message
Override Py_FileSystemDe
Description of the change
Use dark ctypes hackery to change the encoding Python uses when interacting with the filesystem on non-OSX posix machines. This affects open() and most os module functions when passed a unicode filename. Existing locale settings are obeyed, but if an invalid locale or the C locale is given, UTF-8 will be used instead of ascii for encoding and decoding filenames and such like.
Looking through the Python 2.7 source, I believe this is a safe operation. The Py_FileSystemDe
Initially this is likely to just expose a lot of areas where the ui does not handle encoding fallbacks correctly, and the user encoding will still be ascii. For instance, in the test, replacing "init" with "init-repo" results in a UnicodeEncodeError. I don't think changing the user encoding default as well is necessarily the correct thing, and most issues like this are existing usability problems when running on a non-utf-8 terminal.
Do we really want to do this in bzrlib.__init__ ? This will also influence other applications that happen to use bzrlib. Changing the filesystem encoding behind their back seems wrong.
Perhaps it would make more sense to do this in the 'bzr' script?