#2875: WebUI Json dumps Error
---------------------+------------------------------------
 Reporter:  yueyoum  |      Owner:
     Type:  bug      |     Status:  new
 Priority:  minor    |  Milestone:  needs verified
Component:  Unknown  |    Version:  other (please specify)
 Keywords:           |
---------------------+------------------------------------
 when upload torrent via the web ui which the torrent's content contains
 CJK (Chinese, Japanese, Korea) and not encoding by UTF8,

 An Error will occurred at  https://github.com/deluge-
 torrent/deluge/blob/develop/deluge/ui/web/json_api.py#L213

 The error message is:

 {{{
 [ERROR   ] 11:59:38 json_api:271 'utf8' codec can't decode byte 0xe5 in
 position 0: invalid continuation byte
 Traceback (most recent call last):
   File "/usr/lib/python2.7/dist-packages/deluge/ui/web/json_api.py", line
 293, in render
     d = self._on_json_request(request)
   File "/usr/lib/python2.7/dist-packages/deluge/ui/web/json_api.py", line
 265, in _on_json_request
     return self._send_response(request, response)
   File "/usr/lib/python2.7/dist-packages/deluge/ui/web/json_api.py", line
 276, in _send_response
     response = json.dumps(response)
   File "/usr/lib/python2.7/json/__init__.py", line 243, in dumps
     return _default_encoder.encode(obj)
   File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
     chunks = self.iterencode(o, _one_shot=True)
   File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
     return _iterencode(o, 0)
 UnicodeDecodeError: 'utf8' codec can't decode byte 0xe5 in position 0:
 invalid continuation byte
 }}}


 I try to change `response = json.dumps(response)` to `response =
 json.dumps(response, ensure_ascii=False)`, this can fix the error.


 The torrent in the attach file.

--
Ticket URL: <http://dev.deluge-torrent.org/ticket/2875>
Deluge <http://deluge-torrent.org/>
Deluge Project

-- 
You received this message because you are subscribed to the Google Groups 
"Deluge Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/deluge-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to