[rfc] about encodings and redirect output of bzr via pipe

John Arbash Meinel john at arbash-meinel.com
Sun Apr 30 21:14:09 BST 2006


Alexander Belchenko wrote:
> Probably I found the solution for problem of determining actual encoding
> of console when bzr output redirecting to pager ('less' or 'more') via
> pipe. E.g. command:
> 
> $ bzr log | less
> 
> When do this redirection then shell connect stdout of bzr process to
> stdin of next process. So sys.stdout lost 'encoding' attribute. And
> therefore information of actual encoding of console is lost. So, my
> previous approach to fix problem with 'cp866' <-> 'cp1251' on russian
> windows relying on sys.stdout.encoding was vulnerable by pipe.
> 
> But this problem can be solved if using sys.stdin.encoding when
> sys.stdout.encoding is not exists. At least on my win32 machine it works
> as expected:

I think this is a reasonable method. We can just try all of
stdout/stdin/stderr to see if any of them have an encoding.

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060430/d5a32395/attachment.pgp 


More information about the bazaar mailing list