title: flask send_file and unicode filename : broken in IE
body: <p>I wrote a function that generates some csv file on the fly and sends to user for download.</p>
  
  <p>the code is below:</p>
  
  <pre><code>@app.route('/survey/&lt;survey_id&gt;/report')
  def survey_downloadreport(survey_id):  
      survey, bsonobj = survey_get(survey_id)
      resps = response_get_multi(survey_id)
  
      fields = ["_id", "sid", "date", "user_ip"]
      fields.extend(survey.formfields)    
  
      csvf = StringIO.StringIO()
      wr = csv.DictWriter(csvf, fields, encoding = 'cp949')
      wr.writerow(dict(zip(fields, fields)))
      for resp in resps :
          wr.writerow(resp)
  
      csvf.seek(0)
  
      now = datetime.datetime.now()
      report_name = survey.name + "(" + \
                    now.strftime("%Y-%m-%d-%H:%M:%S") +\
                    ")" + ".csv"
  
      report_name = report_name.encode("utf-8")
  
  
  
      return send_file(csvf,
                   as_attachment = True,
                   attachment_filename = report_name)
  </code></pre>
  
  <p>as you can see, the filename is converted from unicode to string and in utf-8  (to be precise, they are in Korean letters.)</p>
  
  <p>the problem is, filenames are completely broken in when page is viewed in IE(no problem in chrome).</p>
  
  <p>It seems like the header has to be edited to match parsing rules for different browsers, but I have no idea how I can do this in flask.</p>