Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 2616 by karsten....@gmail.com: post-review cannot post utf-8 in summary or description
http://code.google.com/p/reviewboard/issues/detail?id=2616

* NOTE: Do not post confidential information in this bug report. *
*       If you need immediate support, please contact            *
*       reviewbo...@googlegroups.com                             *

What version are you running?
RBTools VERSION = (0, 3, 4, 'final', 0, True)

What's the URL of the page containing the problem?
post-review --guess-summary --guess-description


What steps will reproduce the problem?
1. post-review --summary ሴ🐳

What is the expected output? What do you see instead?
Expected output: success
seen output: Traceback (most recent call last):
  File "/usr/bin/post-review", line 9, in <module>
    load_entry_point('RBTools==0.3.4', 'console_scripts', 'post-review')()
File "/usr/lib/python2.7/dist-packages/rbtools/postreview.py", line 4029, in main
    submit_as=options.submit_as)
File "/usr/lib/python2.7/dist-packages/rbtools/postreview.py", line 3628, in tempt_fate
    options.summary)
File "/usr/lib/python2.7/dist-packages/rbtools/postreview.py", line 759, in set_review_request_field
    field: value,
File "/usr/lib/python2.7/dist-packages/rbtools/postreview.py", line 1081, in api_put
    return self.process_json(self.http_put(path, fields))
File "/usr/lib/python2.7/dist-packages/rbtools/postreview.py", line 1027, in http_put
    data = urllib2.urlopen(r).read()
  File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 400, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 418, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1215, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1174, in do_open
    h.request(req.get_method(), req.get_selector(), req.data, headers)
  File "/usr/lib/python2.7/httplib.py", line 958, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 992, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 954, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 812, in _send_output
    msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 91: ordinal not in range(128)


What operating system are you using? What browser?
Ubuntu Linux 12.04

Please provide any additional information below.
A possible patch is to add the following lines to def http_put():

         try:
+            if isinstance(url, unicode):
+                url = url.encode('utf-8')
+            if isinstance(body, unicode):
+                body = body.encode('utf-8')
             r = HTTPRequest(url, body, headers, method='PUT')
             data = urllib2.urlopen(r).read()
             self.cookie_jar.save(self.cookie_file)




--
You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To post to this group, send email to reviewboard-issues@googlegroups.com.
To unsubscribe from this group, send email to 
reviewboard-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/reviewboard-issues?hl=en.

Reply via email to