[MERGE] Make annotate behave in a non-ASCII world (v1)
John Arbash Meinel
john at arbash-meinel.com
Fri Jul 6 20:36:23 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Adeodato Simó wrote:
> * John Arbash Meinel [Fri, 06 Jul 2007 14:50:28 -0400]:
>
> (Heh, sorry for the bomb mailing.)
>
>> to_file.encoding can be None (it happens when you redirect stdout such as:
>> bzr annotate foo | vim -R -)
>> So this line:
>
>> + to_file.write(anno.encode(to_file.encoding, 'replace'))
>
>> Should probably be:
>> encoding = osutils.get_terminal_encoding()
>> to_file.write(anno.encode(encoding, 'replace'))
>
> Why not:
>
> encoding = to_file.encoding or osutils.get_terminal_encoding()
> to_file.write(anno.encode(encoding, 'replace'))
>
Sure.
> ?
>
> Also, if it's None, that means stdout is not a terminal, so why not
> get_user_encoding() instead?
>
> Thanks,
>
That is what 'get_terminal_encoding()' is meant to take care of.
But mostly because on Win32 the terminal encoding is not the same as the user
encoding (stupid code pages for cmd.exe). And |less should be using terminal
encoding, while > file should be using user_encoding.
However AFAIK we cannot tell the difference from within bzr. So as of yet, this
has not been clearly solved.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGjpm3JdeBCYSNAAMRAsdgAJ4nqd6BXbFnwds9NAhY61lMvLo8hACeO7Wk
9PCqsL7mUtEucI+Sv+pMTSI=
=cT94
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list