python: Make invalid UTF-8 sequence messages consistent across Python versions.
authorBen Pfaff <blp@nicira.com>
Fri, 1 Jul 2011 17:11:30 +0000 (10:11 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 28 Jul 2011 18:21:59 +0000 (11:21 -0700)
commit7b3855c50706c6f5805f6b320508ecf9b22cd3b7
tree060a05c99ba932b935f7e411c85406776f6dade9
parentff2abab9c550b90f08b3ddb7487edded0c7903e6
python: Make invalid UTF-8 sequence messages consistent across Python versions.

Given the invalid input <C0 22>, some versions of Python report <C0> as the
invalid sequence and other versions report <C0 22> as the invalid sequence.
Similarly, given input <ED 80 7F>, some report <ED 80> and others report
<ED 80 7F> as the invalid sequence.  This caused spurious test failures for
the test "no invalid UTF-8 sequences in strings - Python", so this commit
makes the messages consistent by dropping the extra trailing byte from the
message.

I first noticed the longer sequences <C0 22> and <ED 80 7F> on Ubuntu
10.04 with python version 2.6.5-0ubuntu1, but undoubtedly it exists
elsewhere also.
python/ovs/json.py