Commit e583da17 authored by Mindiell's avatar Mindiell

Truncate was too violent since twitter modify link length; Unicode for joining...

Truncate was too violent since twitter modify link length; Unicode for joining utf-8 string was not ok
parent d927a2a1
......@@ -565,10 +565,10 @@ class Wantzel(object):
# We have 5 chars for the language, so max-length is 135
title = entry.title.encode("utf-8")
link = entry.link.encode("utf-8")
if len(title) + len(link) > 135:
if len(title) + min(len(link),23) > 135:
# What is the number of chars we need to remove
excess = len(title) + len(link) - 135
title = ''.join([title[:-(excess + 4)], u' ...'])
excess = len(title) + min(len(link),23) - 135
title = ''.join([title[:-(excess + 4)], ' ...'])
tweet(messages["tweet_rp_%s" % language] % (
title,
link
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment