I add Content-Disposition
header to generate filename for download.
self.response.headers['Content-Type'] = 'text/xml'
self.response.headers['Content-Disposition'] = 'attachment; filename=' + os.path.splitext(filename)[0] + '.nfo'
It works well with English characters, but when the filename contains Russian characters (for ex., filename = u'Some video file (2014).avi'
) it fails. I tried different combinations of encode('utf-8')
and urllib.quote
, but it doesn't help.