[BUG] 54173 Output encoding

Alexander Belchenko bialix at ukr.net
Wed Oct 18 07:15:57 BST 2006


Richard Wilbur пишет:
> John,
> 
> You commented on bug 54173 in Launchpad,
> 
> "This is because note() et al assume the output encoding is utf8, rather
> than actually checking the console encoding.
> In general, we need to update so that note() and error() use the right
> encoding (mutter only goes to the log file, so utf8 is okay)."
> 
> Which note() are you referring to?  I found a list of 'def note('
> 
> ../bzrlib/trace.py:def note(*args, **kwargs):

note() in trace.py.
trace.py is bzr logging subsystem.

  > And when you mention 'note() et al', what are the others?  Is this
> specifically console output from commands that we need to properly
> encode?  I assume this generally refers only to filesystem entities like
> path names and file names since bzr is currently not translated into
> other languages.

Yes, it is.

> Do you recommend using bzrlib.osutils.get_user_encoding() as the source
> of the proper encoding?

No. It's wrong choice. Better to use bzrlib.osutils.get_terminal_encoding().

On Windows console encoding could be different from user encoding.

See commands.py source for definition of class Command and method 
_setup_outf(). This method prepare stdout for bzr. I think you need do 
similar thing for stderr.

--
Alexander





More information about the bazaar mailing list