Bug 1316431 - [abrt] anki: httplib.py:1028:putheader:UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)
Summary: [abrt] anki: httplib.py:1028:putheader:UnicodeEncodeError: 'ascii' codec can'...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: anki
Version: 23
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Christian Krause
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:67fd59e182cce3dd3d3b103781c...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-10 08:46 UTC by Roman
Modified: 2016-04-17 09:12 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-17 09:12:53 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: backtrace (2.19 KB, text/plain)
2016-03-10 08:46 UTC, Roman
no flags Details
File: environ (5.01 KB, text/plain)
2016-03-10 08:46 UTC, Roman
no flags Details

Description Roman 2016-03-10 08:46:10 UTC
Description of problem:
Tried to paste an image from URL that is not ASCII. To be specific, this one: http://姫路城.blog.so-net.ne.jp/_images/blog/_a90/xn--uisz2cnx0g/E5A7ABE8B7AFE59F8E20E6B7B7E99B9120E5B9B3E697A5.jpg

I think the issue is known to the Anki developer.

Version-Release number of selected component:
anki-2.0.33-1.fc23

Additional info:
reporter:       libreport-2.6.4
cmdline:        python /usr/bin/anki
dso_list:       python-libs-2.7.10-8.fc23.x86_64
executable:     /usr/bin/anki
kernel:         4.3.5-300.fc23.x86_64
runlevel:       N 5
type:           Python
uid:            1000

Truncated backtrace:
httplib.py:1028:putheader:UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)

Traceback (most recent call last):
  File "/usr/share/anki/aqt/editor.py", line 998, in keyPressEvent
    self.onPaste()
  File "/usr/share/anki/aqt/editor.py", line 1017, in onPaste
    mime = self.mungeClip()
  File "/usr/share/anki/aqt/editor.py", line 1073, in mungeClip
    mime = self._processMime(mime)
  File "/usr/share/anki/aqt/editor.py", line 1102, in _processMime
    return self._processHtml(mime)
  File "/usr/share/anki/aqt/editor.py", line 1163, in _processHtml
    newHtml += self.editor.urlToLink(url)
  File "/usr/share/anki/aqt/editor.py", line 799, in urlToLink
    fname = self.urlToFile(url)
  File "/usr/share/anki/aqt/editor.py", line 817, in urlToFile
    return self._retrieveURL(url)
  File "/usr/share/anki/aqt/editor.py", line 842, in _retrieveURL
    filecontents = urllib2.urlopen(req).read()
  File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/usr/lib64/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/lib64/python2.7/urllib2.py", line 1229, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib64/python2.7/urllib2.py", line 1196, in do_open
    h.request(req.get_method(), req.get_selector(), req.data, headers)
  File "/usr/lib64/python2.7/httplib.py", line 1053, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.7/httplib.py", line 1092, in _send_request
    self.putheader(hdr, value)
  File "/usr/lib64/python2.7/httplib.py", line 1028, in putheader
    values = [str(v) for v in values]
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)

Local variables in innermost frame:
header: 'Host'
self: <httplib.HTTPConnection instance at 0x7f3fafe2de60>
values: (u'\xe5\xa7\xab\xe8\xb7\xaf\xe5\x9f\x8e.blog.so-net.ne.jp',)
v: u'\xe5\xa7\xab\xe8\xb7\xaf\xe5\x9f\x8e.blog.so-net.ne.jp'

Comment 1 Roman 2016-03-10 08:46:15 UTC
Created attachment 1134760 [details]
File: backtrace

Comment 2 Roman 2016-03-10 08:46:17 UTC
Created attachment 1134761 [details]
File: environ

Comment 3 Christian Krause 2016-04-17 09:12:53 UTC
As noted, this issue is tracked upstream:

https://anki.tenderapp.com/discussions/ankidesktop/17132-anki-reports-an-error-when-pasting-an-image-from-non-ascii-url

Unfortunately, it is not yet solved in the upcoming release 2.0.36.


Note You need to log in before you can comment on or make changes to this bug.