equal
deleted
inserted
replaced
529 |
529 |
530 def set_content_type(self, content_type, filename=None, encoding=None): |
530 def set_content_type(self, content_type, filename=None, encoding=None): |
531 """set output content type for this request. An optional filename |
531 """set output content type for this request. An optional filename |
532 may be given |
532 may be given |
533 """ |
533 """ |
534 if content_type.startswith('text/'): |
534 if content_type.startswith('text/') and ';charset=' not in content_type: |
535 content_type += ';charset=' + (encoding or self.encoding) |
535 content_type += ';charset=' + (encoding or self.encoding) |
536 self.set_header('content-type', content_type) |
536 self.set_header('content-type', content_type) |
537 if filename: |
537 if filename: |
538 if isinstance(filename, unicode): |
538 if isinstance(filename, unicode): |
539 filename = header(filename).encode() |
539 filename = header(filename).encode() |