Fix UnicodeDecodeError when commit message contains non-ascii character

Review Request #10121 — Created Aug. 15, 2018 and discarded

Information

RBTools
master

Reviewers

subprocess output data is str type, convert it to unicode when results_unicode is true

  • Posted some changes.
  • Ran unit tests.
Description From Last Updated

When results_unicode is True, subprocess is called with universal_newlines=True. In this case, it should return results as unicode instead of …

daviddavid

E501 line too long (85 > 79 characters)

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

fangwentong
fangwentong
fangwentong
fangwentong
fangwentong
fangwentong
fangwentong
fangwentong
david
  1. 
      
  2. Show all issues

    When results_unicode is True, subprocess is called with universal_newlines=True. In this case, it should return results as unicode instead of bytes. Is there a particular case you're seeing where this isn't working?

    1. Yes, I tested this on MacOS and ubuntu with python2.7, subprocess.communicate() returns str instead of unicode.

      when commit message contains non-ascii character, rbt post --stamp will raise UnicodeDecodeError and fail add stamp to commit message.

      see the test case in diff 6: https://reviews.reviewboard.org/r/10121/diff/6/. this testcase cause flake8 internal error, so I remove the testcase in diff 7

    2. When commit message contains non-ascii character, rbt post -r will fail and prompt UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128).

      Modification in rbtools/utils/console.py fixed this problem.

  3. 
      
david
Review request changed

Status: Discarded

Loading...