Merge lp:~gz/bzr/2.5_help_translation_unicode_error_930919 into lp:bzr/2.5
Status: | Merged |
---|---|
Approved by: | Vincent Ladeuil |
Approved revision: | no longer in the source branch. |
Merged at revision: | 6490 |
Proposed branch: | lp:~gz/bzr/2.5_help_translation_unicode_error_930919 |
Merge into: | lp:bzr/2.5 |
Diff against target: |
84 lines (+37/-8) 2 files modified
bzrlib/help.py (+3/-2) bzrlib/tests/blackbox/test_help.py (+34/-6) |
To merge this branch: | bzr merge lp:~gz/bzr/2.5_help_translation_unicode_error_930919 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
IWATA Hidetaka | Pending | ||
bzr-core | Pending | ||
Review via email: mp+94756@code.launchpad.net |
Commit message
Default help output to ui wrapped stream rather than raw stdout for better encoding handling
Description of the change
Make the display of unicode help via the help command use a default stream that knows how to deal with unicode, rather than stdout directly which may not. The --help switch is not affected as it uses a completely different code path with a different set of issues.
There are still some niggles unaddressed. Callers could still pass in a dumb stream that it's not safe to write arbitrary unicode to. Also, as gettext is a little more forgiving than system locales, it's possible to get things translated that then bzr has no idea how to encode. In this case, the user does get a nice clear error message and non-ascii characters replaced with question marks, so it should be clear enough that they need to install the relevant locale. Possibly the fallback could be smarter, but moving that choice into bzrlib.ui seems like an improvement regardless.
First, My report is a bit wrong.
I said that `bzr command-name --help` works, but it also can fail depending on the target command.
e.g. If LANG=ja, `bzr commit --help` works, but `bzr diff --help` does not work.
I’ve tested this patch under the environment of Windows + Python 2.6.6, and confirmed this fixes
problem about `bzr help command-name`.
Thank you.