diff -r 17658dea048d trac/ticket/query.py
--- a/trac/ticket/query.py	Thu May 11 13:51:23 2006 +0200
+++ b/trac/ticket/query.py	Thu May 11 14:02:20 2006 +0200
@@ -613,7 +613,7 @@ class QueryModule(Component):
            self.env.is_component_enabled(ReportModule):
             req.hdf['query.report_href'] = req.href.report()
 
-    def export_csv(self, query, sep=','):
+    def export_csv(self, query, sep=',', mimetype='text/plain'):
         content = StringIO()
         cols = query.get_columns()
         content.write(sep.join([col for col in cols]) + CRLF)
@@ -624,7 +624,7 @@ class QueryModule(Component):
                                                         .replace('\n', ' ')
                                                         .replace('\r', ' ')
                                     for col in cols]) + CRLF)
-        return (content.getvalue(), 'text/plain;charset=utf-8')
+        return (content.getvalue(), '%s;charset=utf-8' % mimetype)
 
     def export_rss(self, req, query):
         query.verbose = True
diff -r 17658dea048d trac/ticket/web_ui.py
--- a/trac/ticket/web_ui.py	Thu May 11 13:51:23 2006 +0200
+++ b/trac/ticket/web_ui.py	Thu May 11 14:02:20 2006 +0200
@@ -412,7 +412,7 @@ class TicketModule(TicketModuleBase):
 
     # Internal methods
 
-    def export_csv(self, ticket, sep=','):
+    def export_csv(self, ticket, sep=',', mimetype='text/plain'):
         content = StringIO()
         content.write(sep.join(['id'] + [f['name'] for f in ticket.fields])
                       + CRLF)
@@ -421,7 +421,7 @@ class TicketModule(TicketModuleBase):
                                  .replace(sep, '_').replace('\\', '\\\\')
                                  .replace('\n', '\\n').replace('\r', '\\r')
                                  for f in ticket.fields]) + CRLF)
-        return (content.getvalue(), 'text/plain;charset=utf-8')
+        return (content.getvalue(), '%s;charset=utf-8' % mimetype)
         
     def export_rss(self, req, ticket):
         db = self.env.get_db_cnx()

