Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
utf-8 workaround for python 2.x
  • Loading branch information
chubin committed Jul 7, 2019
1 parent a9fa608 commit 113b466
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/fmt/comments.py
Expand Up @@ -261,6 +261,8 @@ def code_blocks(text, wrap_lines=False, unindent_code=False):
Split `text` into blocks of text and code.
Return list of tuples TYPE, TEXT
"""
text = text.encode('utf-8')

lines = [x.rstrip('\n') for x in text.splitlines()]
lines_classes = zip(_classify_lines(lines), lines)

Expand Down Expand Up @@ -294,7 +296,10 @@ def beautify(text, lang, options):
# if mode is unknown, just don't transform the text at all
return text

text = text.encode('utf-8')
digest = "t:%s:%s:%s" % (hashlib.md5(text).hexdigest(), lang, mode)
# if lang == 'git':
# cache.delete(digest)
answer = cache.get(digest)
if answer:
return answer
Expand Down

0 comments on commit 113b466

Please sign in to comment.