bbea22f773
I'm not sure what print_safe_encoding is trying to do (Ie834931a549175471af029a6ec4d5794543d8c92). print(str.encode(sys.stdout.encoding, 'replace')) means that print() ends up getting a bytes-object encoded in the output encoding. Thus print() is then going to output this as raw bytes... not only is unicode going to come out as "\x..\x.." etc, but even newlines get squished and you end up with stuff like $ /tmp/gitreview3/bin/git-review b'remote: \rremote: Processing changes: updated: 1, refs: 1\rremote: Processing changes: updated: 1, I think this problem stems from not ensuring that incoming data (output of git) is encoded as a string. By setting universal_newlines=True in run_command_status() we automatically ensure that any incoming data is a unicode str, not bytes. The final section, with the message about rhbz#1058167, appears to be related to running git under an alternative locale where it's output is translated. I1bf1124f0b09d6658a7b0703e3b9e74ed80f4eea changed things to run the commands under C locale, so there shouldn't be unicode in here I wouldn't think. But, by ensuring it's just a string, we can print() it safely anyway. Change-Id: I596dcba317ecfbaf437cb72d9850580ed6765fce |
||
---|---|---|
.. | ||
tests | ||
__init__.py | ||
cmd.py |