1- #$Id: actions.py,v 1.54 2006-01-23 03:42:27 richard Exp $
1+ #$Id: actions.py,v 1.55 2006-01-25 03:14:40 richard Exp $
22
3- import re , cgi , StringIO , urllib , Cookie , time , random , csv
3+ import re , cgi , StringIO , urllib , Cookie , time , random , csv , codecs
44
55from roundup import hyperdb , token , date , password
66from roundup .i18n import _
@@ -961,7 +961,7 @@ def handle(self):
961961 matches = None
962962
963963 h = self .client .additional_headers
964- h ['Content-Type' ] = 'text/csv'
964+ h ['Content-Type' ] = 'text/csv; charset=%s' % self . client . charset
965965 # some browsers will honor the filename here...
966966 h ['Content-Disposition' ] = 'inline; filename=query.csv'
967967
@@ -971,7 +971,12 @@ def handle(self):
971971 # all done, return a dummy string
972972 return 'dummy'
973973
974- writer = csv .writer (self .client .request .wfile )
974+ wfile = self .client .request .wfile
975+ if self .client .charset != self .client .STORAGE_CHARSET :
976+ wfile = codecs .EncodedFile (wfile ,
977+ self .client .STORAGE_CHARSET , self .client .charset , 'replace' )
978+
979+ writer = csv .writer (wfile )
975980 writer .writerow (columns )
976981
977982 # and search
0 commit comments