API oopsing with UnicodeEncodeError
Bug #262328 reported by
Ursula Junque
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
High
|
Leonard Richardson |
Bug Description
As seen on OOPS-970EA148 and OOPS-970EA149, API is oopsing when trying to handle some unicode chars:
UnicodeEncodeError: 'ascii' codec can't encode character u'\\xe1' in position 1: ordinal not in range(128)
Changed in launchpad-foundations: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
The OOPS was triggered trying to retrieve a project that has UNICODE in its display name, title, and summary: /edge.launchpad .net/sachco
https:/
This is the client-side query that caused the OOPS (where 'lp' is a launchpad object):
>>> lp.projects[ 'sachco' ] bac/canonical/ lp-branches/ ws_ps/lib/ launchpadlib/ resource. py", line 534, in __getitem__ loads(self. _root._ browser. get(url) ) bac/canonical/ lp-branches/ ws_ps/lib/ launchpadlib/ _browser. py", line 180, in get bac/canonical/ lp-branches/ ws_ps/lib/ launchpadlib/ _browser. py", line 170, in _request errors. HTTPError: HTTP Error 500: Internal Server Error
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/home/
representation = simplejson.
File "/home/
response, content = self._request(url)
File "/home/
raise HTTPError(response, content)
launchpadlib.
>>>
And here is the value of 'content' from the exception:
(Pdb) print e.content
'ascii' codec can't encode character u'\xe1' in position 1: ordinal not in range(128)
Traceback (most recent call last): launchpad. net/edge/ launchpad/ lib/zope/ publisher/ publish. py", line 138, in publish callObject( request, object) launchpad. net/edge/ launchpad/ lib/canonical/ launchpad/ webapp/ publication. py", line 327, in callObject getPositionalAr guments( ), request) launchpad. net/edge/ launchpad/ lib/zope/ publisher/ publish. py", line 113, in mapply launchpad. net/edge/ launchpad/ lib/zope/ publisher/ publish. py", line 119, in debug_call launchpad. net/edge/ launchpad/ lib/canonical/ lazr/rest/ resource. py", line 460, in __call__ launchpad. net/edge/ launchpad/ lib/canonical/ lazr/rest/ resource. py", line 579, in do_GET itionalGET( ) launchpad. net/edge/ launchpad/ lib/canonical/ lazr/rest/ resource. py", line 160, in handleCondition alGET media_type) launchpad. net/edge/ launchpad/ lib/canonical/ lazr/rest/ resource. py", line 512, in getETag append( str(value) )
File "/srv/edge.
result = publication.
File "/srv/edge.
return mapply(ob, request.
File "/srv/edge.
return debug_call(object, args)
File "/srv/edge.
return object(*args)
File "/srv/edge.
return self.do_GET()
File "/srv/edge.
media_type = self.handleCond
File "/srv/edge.
existing_etag = self.getETag(
File "/srv/edge.
values.
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 1: ordinal not in range(128)