UnicodeEncodeError when run under Python 2.7
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Checkbox Support Library |
Fix Released
|
High
|
Daniel Manrique |
Bug Description
checkbox-support needs to work well under Python 2.7 since it's used in hexr which runs under 2.7.
James reported this:
Traceback (most recent call last):
File "apps/uploads/
sys.
File "apps/uploads/
messages = parse_stream(
File "apps/uploads/
parser.
File "/home/
line 1152, in run
self.
File "/home/
line 1125, in parseRoot
parser(result, child)
File "/home/
line 936, in parseContext
result.
File "/home/
line 643, in addContext
text = text.decode(
File "/home/
line 16, in decode
return codecs.
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
position 99516: ordinal not in range(128)
No JSON object could be decoded
How to reproduce:
- Run the attached submission.xml through the hexr checkbox_parser script using Python 2.7. Assuming up-to-date checkouts of lp:hexr and lp:checkbox, run this inside the hexr tree:
PYTHONPATH=
Expected result:
- Nothing, since we're sending the good output to /dev/null
Actual result:
- Trace as seen above.
And as noted, running the same thing with python3 doesn't return anything (meaning it was parsed correctly).
Related branches
- Zygmunt Krynicki (community): Approve
-
Diff: 62 lines (+30/-4)3 files modifiedcheckbox-support/checkbox_support/parsers/submission.py (+7/-1)
checkbox-support/checkbox_support/parsers/tests/fixtures/submission_info_non_ascii.xml (+15/-0)
checkbox-support/checkbox_support/parsers/tests/test_submission.py (+8/-3)
Changed in checkbox-support: | |
importance: | Undecided → High |
Changed in checkbox-support: | |
status: | New → In Progress |
assignee: | nobody → Daniel Manrique (roadmr) |
Changed in checkbox-support: | |
status: | In Progress → Fix Committed |
milestone: | none → 0.20 |
Changed in checkbox-support: | |
status: | Fix Committed → Fix Released |