summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-03-01 20:37:37 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2010-03-01 20:37:37 +0100
commitfb6bceed8c1c32929e1d024b2ce43b945026fe83 (patch)
tree4e96ec348f4608504ee812fc5d8ed0323bbe604e
parent4f28fd90241dced95cb4d53cef6b4166e1af22f7 (diff)
Decode text to utf-8 when previewing.
-rw-r--r--pastepy.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pastepy.py b/pastepy.py
index 9ad21de..2485c2c 100644
--- a/pastepy.py
+++ b/pastepy.py
@@ -63,9 +63,9 @@ class Paste(object):
def preview(self, mp):
try:
- lex = get_lexer_by_name(mp['syntax'].value)
+ lex = get_lexer_by_name(mp['syntax'].value.decode('utf8'))
lexername = lex.name
- text = highlight(mp['text'].value, lex, self.formatter)
+ text = highlight(mp['text'].value.decode('utf8'), lex, self.formatter)
except:
return self.message('Could not find the lexer "%s".' % mp['syntax'].value, 'Error')
@@ -75,9 +75,9 @@ class Paste(object):
'header': '%s &ndash; Preview' % settings.pastebin_name,
'hash': None,
'date': datetime.datetime.utcnow().ctime(),
- 'nick': mp['nick'].value or 'Anoynmous',
+ 'nick': mp['nick'].value.decode('utf8') or 'Anoynmous',
'syntax': lexername,
- 'pastetitle': mp['title'].value or 'Untitled',
+ 'pastetitle': mp['title'].value.decode('utf8') or 'Untitled',
'text': text,
}))]