changeset 2845:74c29582f7a1

send_raw: encode filename in utf-8, the same way as AttachFile code does it
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 20 Sep 2007 18:00:12 +0200
parents 34632d44f50f
children 4825f1a252dc
files MoinMoin/Page.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Thu Sep 20 17:37:57 2007 +0200
+++ b/MoinMoin/Page.py	Thu Sep 20 18:00:12 2007 +0200
@@ -977,9 +977,11 @@
             text = self.encodeTextMimeType(self.body)
             request.setHttpHeader("Content-Length: %d" % len(text))
             if content_disposition:
-                file_name = "%s.txt" % self.page_name
+                # TODO: fix the encoding here, plain 8 bit is not allowed according to the RFCs
+                # There is no solution that is compatible to IE except stripping non-ascii chars
+                filename_enc = "%s.txt" % self.page_name.encode(config.charset)
                 request.setHttpHeader('Content-Disposition: %s; filename="%s"' % (
-                                      content_disposition, file_name))
+                                      content_disposition, filename_enc))
         else:
             request.setHttpHeader('Status: 404 NOTFOUND')
             text = u"Page %s not found." % self.page_name