508: Can't post diffs containing 8-bit (non-ascii) characters

sqr***@gmai***** (Google Code) (Is this you? Claim this profile.)
Sept. 23, 2008
What's the URL of the page containing the problem?

Error while uploading diff, either with post-review or via attach diff
function in UI.  Debug output from post-review:

Error uploading diff: One or more fields had errors (105)
>>> {u'fields': {u'path': [u"'ascii' codec can't decode byte 0x91 in
position 10
24: ordinal not in range(128)"]}, u'stat': u'fail', u'err': {u'msg': u'One
or mo
re fields had errors', u'code': 105}}
Your review request still exists, but the diff is not attached.


What steps will reproduce the problem?
1. Edit a file, insert a non-ascii character (in this case, 0x91)
2. Post review request for diff
3.

What is the expected output? What do you see instead?

Expect files to be uploaded correctly.

What operating system are you using? What browser?

Widows XP for client
Ubuntu/Linux for server

Please provide any additional information below.

Tried updating post-review to set Content-Transfer-Encoding to 8bit and
tried utf-8 charset as well, but they seemed to be ignored by server.  Not
familiar enough with Python & Django to suggest a fix.
chipx86
#1 chipx86
What revision are you using of Django?

Can you attach a full traceback? (Be sure to filter out any sensitive info.)
  • +NeedInfo
#2 roland*******@gmai***** (Google Code) (Is this you? Claim this profile.)
I had the same experience, adding a traceback:

'ascii' codec can't decode byte 0xc2 in position 92: ordinal not in range(128)

Traceback (most recent call last):
  File "/var/www/reviewboard/diffviewer/views.py", line 82, in view_diff
    files = get_diff_files(diffset, None, interdiffset, highlighting)
  File "/var/www/reviewboard/diffviewer/diffutils.py", line 599, in get_diff_files
    enable_syntax_highlighting)
  File "/var/www/reviewboard/diffviewer/diffutils.py", line 518, in generate_files
    lambda: get_chunks(filediff.diffset,
  File "/var/www/reviewboard/djblets/util/misc.py", line 49, in cache_memoize
    data = lookup_callable()
  File "/var/www/reviewboard/diffviewer/diffutils.py", line 521, in <lambda>
    enable_syntax_highlighting))
  File "/var/www/reviewboard/diffviewer/diffutils.py", line 394, in get_chunks
    a[i1:i2], b[j1:j2], oldlines, newlines)
  File "/var/www/reviewboard/diffviewer/diffutils.py", line 245, in diff_line
    if oldline and newline and oldline != newline:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 92: ordinal not
in range(128)

The review has been generated by post-review SVN Rev. 1390.

The character cauing the error is a paragraph sign '§' which has been replaced in the
newer file version.

Django is from the trunk SVN-Rev. 7877

chipx86
#3 chipx86
If you can generate a diff against reviews.review-board.org that reproduces this, it
would greatly help.
  • -Priority-Medium
    +Priority-High
    +Component-DiffParser
#4 sqr***@gmai***** (Google Code) (Is this you? Claim this profile.)
BTW, for me this problem went away after updating django.  Didn't check which
revision I'm on, but newer versions seem to handle this correctly.
chipx86
#5 chipx86
Excellent. I was hoping to hear that.

roland, what about you? I'll probably close this out soon unless you're still hitting
this.
david
#6 david
Assuming fixed in django.
  • -NeedInfo
    +Fixed