[MERGE] Use self.outf in cmd_ignored (was: Re: Introduction / exception: UnicodeEncodeError)

Lukáš Lalinský lalinsky at gmail.com
Tue Dec 18 15:27:28 GMT 2007


On Ut, 2007-12-18 at 15:56 +0100, Christian Tschabuschnig wrote:
> Hello,

Hi,

> [...]

> Traceback (most recent call last):
>   File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 802,
> in run_bzr_catch_errors
>     return run_bzr(argv)
>   File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 758,
> in run_bzr
>     ret = run(*run_argv)
>   File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 492,
> in run_argv_aliases
>     return self.run(**all_cmd_args)
>   File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 768,
> in ignore_pipe
>     result = func(*args, **kwargs)
>   File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 2011,
> in run
>     print '%-50s %s' % (path, pat)
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in
> position 59: ordinal not in range(128)

> [...]

> I don't know much about character-encoding so I don't really know, where
> to look. 

The problem is that it tries to write to raw stdout, which works
properly if stdout is a terminal, because it can detect which encoding
should be used. But Python doesn't do this for redirected output and
assumes 'ascii' instead. The attached patch fixes this problem.

Lukas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: unicode-ignored.diff
Type: text/x-patch
Size: 4601 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20071218/86b84ce5/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Toto je =?ISO-8859-1?Q?digit=E1lne?=
	=?ISO-8859-1?Q?_podp=EDsan=E1?= =?UTF-8?Q?_=C4=8Das=C5=A5?=
	=?ISO-8859-1?Q?_spr=E1vy?=
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20071218/86b84ce5/attachment-0001.pgp 


More information about the bazaar mailing list