I first thought my problem was solved, until I tried to concatenate an utf8 string to the error message returned by the NSURLConnection object, and I still have an UnicodeEncodeError exception.
The problem seems to be that the localizedDescription() function returns an ascii string containing utf-8 characters, instead of an unicode one.
The following code fails for localized error messages containing non ascii characters, returned by the system:
from Foundation import *
url = NSURL.URLWithString_("http://invalid
request = NSURLRequest.requestWithURL_(url)
(data, response, error)= NSURLConnection.sendSynchronousRequest_returningResponse_error_(request)
print u"error: " + error.localizedDescription().encode('utf-8')
This also fails using the Terminal.
I didn't dig yet into the PyObjc bridge, but could it be a problem in the declared encoding for the NSError.localizedDescription() function ?