The headers returned by content_disposition must be either in Unicode or in ASCII. The encode function expects a Unicode or ASCII string. The quote function from urllib2 expects a UTF-8 string and retruns a ASCII string. opw:634205 Fixes #6160, #6557