[MERGE] Make annotate behave in a non-ASCII world (v1)

Adeodato Simó dato at net.com.org.es
Fri Jul 6 20:22:04 BST 2007


* 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'))

?

Also, if it's None, that means stdout is not a terminal, so why not
get_user_encoding() instead?

Thanks,

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
A celebrity is a person who works hard all his life to become well known,
then wears dark glasses to avoid being recognized.
                -- Fred Allen




More information about the bazaar mailing list