UnicodeEncodeError from `bzr send --help` when localisation is enabled

Bug #1068936 reported by Welton Rodrigo Torres Nascimento
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

/var/crash/bzr.1000.2012-10-20T01:52.crash is an empty file.

COMMAND:

bzr send --help | less

ERROR:

bzr: ERROR: exceptions.UnicodeEncodeError: 'ascii' codec can't encode characters in position 116-117: ordinal not in range(128)

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 930, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 1141, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 649, in run_argv_aliases
    self.outf.write(self.get_help_text())
  File "/usr/lib/python2.7/dist-packages/bzrlib/ui/text.py", line 669, in write
    self.wrapped_stream.write(to_write)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 116-117: ordinal not in range(128)

bzr 2.6b2 on python 2.7.3 (Linux-3.5.0-17-generic-i686-with-
    Ubuntu-12.10-quantal)
arguments: ['/usr/bin/bzr', 'send', '--help']
plugins: bash_completion[2.6b2], changelog_merge[2.6b2], launchpad[2.6b2],
    netrc_credential_store[2.6b2], news_merge[2.6b2], po_merge[2.6b2],
    weave_fmt[2.6b2]
encoding: 'utf-8', fsenc: 'UTF-8', lang: 'pt_BR.UTF-8'

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.

Revision history for this message
Vincent Ladeuil (vila) wrote :

I can't reproduce this error locally even with:

   LANG=pt_BR.UTF-8 bzr send --help

which emits:

bzr: warning: unsupported locale setting
  bzr could not set the application locale.
  Although this should be no problem for bzr itself, it might
  cause problems with some plugins. To investigate the issue,
  look at the output of the locale(1p) tool.

because I don't have the pt_BR locale installed.

ERROR:

bzr: ERROR: exceptions.UnicodeEncodeError: 'ascii' codec can't encode characters in position 116-117: ordinal not in range(128)

should indicate that bzr cannot find the right encoding to use and falls back to ascii, so there is probably something weird in your setup that bzr fails to recognize, not sure what though :-/

Changed in bzr:
status: New → Incomplete
Revision history for this message
Martin Packman (gz) wrote :

Similar to bug 930919, but here a wrapped stream is being used. What's special here is cmd_send has `encoding_type = 'exact'` set as it wants binary output... But that's not true with --help where correct unicode handling is needed.

Changed in bzr:
importance: Undecided → Medium
status: Incomplete → Confirmed
tags: added: i18n
summary: - bzr: ERROR: exceptions.UnicodeEncodeError: 'ascii' codec can't encode
- characters in position 116-117: ordinal not in range(128)
+ UnicodeEncodeError from `bzr send --help` when localisation is enabled
Revision history for this message
Vincent Ladeuil (vila) wrote :

@mgz: Thanks, I suspected there was something related to @display_command and encoding but couldn't remember the history around send and its output.

So you're implying that the fix will be to delay the encoding setting to 'exact' to *after* help has been handled (if it needs to) ?

Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.