diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-03-01 20:37:37 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-03-01 20:37:37 +0100 |
commit | fb6bceed8c1c32929e1d024b2ce43b945026fe83 (patch) | |
tree | 4e96ec348f4608504ee812fc5d8ed0323bbe604e | |
parent | 4f28fd90241dced95cb4d53cef6b4166e1af22f7 (diff) |
Decode text to utf-8 when previewing.
-rw-r--r-- | pastepy.py | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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 – 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, }))] |