diff options
-rw-r--r-- | pastepy.py | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -34,7 +34,7 @@ class Paste(object): random.seed() def message(self, msg, title = 'Message'): - self.start_response('200 OK', [('Content-Type', 'text/html')]) + self.start_response('200 OK', [('Content-Type', 'text/html; charset=utf-8')]) return [str(templates.message(searchList = { 'title': '%s – %s' % (settings.pastebin_name, title), 'header': title, @@ -51,7 +51,7 @@ class Paste(object): return self.add_paste(mp) else: return self.message('Invalid type "%s".' % mp['type'].value, 'Error') - self.start_response('200 OK', [('Content-Type', 'text/html')]) + self.start_response('200 OK', [('Content-Type', 'text/html; charset=utf-8')]) return [str(templates.paste(searchList = { 'title': settings.pastebin_name, 'header': settings.pastebin_name, @@ -69,7 +69,7 @@ class Paste(object): except: return self.message('Could not find the lexer "%s".' % mp['syntax'].value, 'Error') - self.start_response('200 OK', [('Content-Type', 'text/html')]) + self.start_response('200 OK', [('Content-Type', 'text/html; charset=utf-8')]) return [str(templates.view(searchList = { 'title': settings.pastebin_name, 'header': '%s – Preview' % settings.pastebin_name, @@ -134,7 +134,7 @@ class Paste(object): finally: session.close() - self.start_response('200 OK', [('Content-Type', 'text/html')]) + self.start_response('200 OK', [('Content-Type', 'text/html; charset=utf-8')]) return [str(templates.view(searchList = { 'title': '%s – View paste – %s' % (settings.pastebin_name, paste.title or 'Untitled'), 'header': '%s – View paste' % settings.pastebin_name, @@ -155,7 +155,7 @@ class Paste(object): finally: session.close() - self.start_response('200 OK', [('Content-Type', 'text/plain')]) + self.start_response('200 OK', [('Content-Type', 'text/plain; charset=utf-8')]) return [paste.text.encode('utf8')] def highlight_stylesheet(self): @@ -165,9 +165,9 @@ class Paste(object): def static(self): filename = settings.static_root + os.path.sep + self.path[1] if not self.path[1] in ('paste.css', 'edit.js', 'view.js') or not os.path.exists(filename): - self.start_response('404 Not Found', [('Content-Type', 'text/html'), ('Location', '/')]) + self.start_response('404 Not Found', [('Content-Type', 'text/html; charset=utf-8'), ('Location', '/')]) return ['<a href="/">asdf</a>'] - self.start_response('200 OK', [('Content-Type', mimetypes.guess_type(filename)[0] or 'text/plain')]) + self.start_response('200 OK', [('Content-Type', mimetypes.guess_type(filename)[0] or 'text/plain; charset=utf-8')]) return open(filename) def __call__(self, environ, start_response): |