summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-04-14 15:43:08 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-04-14 15:43:08 +0200
commitd883d0f9d84bffe0b9731c1ea93a563e61b39cde (patch)
tree7634f1bf42595df1c2f3dd5fe83fd0eb0785e403
parent34adfa1b253f732ff6deae1d7f691fb4f1ddb526 (diff)
Specify charset in Content-Type.
-rw-r--r--pastepy.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/pastepy.py b/pastepy.py
index 10b82a5..1431d23 100644
--- a/pastepy.py
+++ b/pastepy.py
@@ -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 &ndash; %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 &ndash; 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 &ndash; View paste &ndash; %s' % (settings.pastebin_name, paste.title or 'Untitled'),
'header': '%s &ndash; 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):