← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-sprint-attendees-charset into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-sprint-attendees-charset into launchpad:master.

Commit message:
Add charset="utf-8" to Content-Type for sprint attendees data

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398895

This is otherwise harmless, and avoids some test failures on Python 3.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-sprint-attendees-charset into launchpad:master.
diff --git a/lib/lp/blueprints/browser/sprint.py b/lib/lp/blueprints/browser/sprint.py
index 6ba5372..4c342b5 100644
--- a/lib/lp/blueprints/browser/sprint.py
+++ b/lib/lp/blueprints/browser/sprint.py
@@ -620,7 +620,8 @@ class SprintAttendeesCsvExportView(LaunchpadView):
         rows = [[six.ensure_str(column)
                  for column in row]
                 for row in rows]
-        self.request.response.setHeader('Content-type', 'text/csv')
+        self.request.response.setHeader(
+            'Content-type', 'text/csv;charset="utf-8"')
         self.request.response.setHeader(
             'Content-disposition',
             'attachment; filename=%s-attendees.csv' % self.context.name)
diff --git a/lib/lp/blueprints/stories/sprints/xx-sprints.txt b/lib/lp/blueprints/stories/sprints/xx-sprints.txt
index f1b0ced..91daa95 100644
--- a/lib/lp/blueprints/stories/sprints/xx-sprints.txt
+++ b/lib/lp/blueprints/stories/sprints/xx-sprints.txt
@@ -473,18 +473,18 @@ First, we add a couple of IRC nicknames for Carlos.
 
     >>> browser.getLink('Export attendees to CSV').click()
     >>> print(browser.headers['content-type'])
-    text/csv
+    text/csv;charset=...utf-8...
 
     >>> carlos_browser = setupBrowser(auth='Basic carlos@xxxxxxxxxxxxx:test')
     >>> carlos_browser.open('http://launchpad.test/sprints/ubz')
     >>> carlos_browser.getLink('Export attendees to CSV').click()
     >>> print(carlos_browser.headers['content-type'])
-    text/csv
+    text/csv;charset=...utf-8...
 
     >>> admin_browser.open('http://launchpad.test/sprints/ubz')
     >>> admin_browser.getLink('Export attendees to CSV').click()
     >>> print(admin_browser.headers['content-type'])
-    text/csv
+    text/csv;charset=...utf-8...
 
 The resulting CSV file lists physical attendance correctly.