print punycode encoded urls if they contain non-ascii chars. Fixes #7204

This commit is contained in:
Yann Leboulanger 2012-09-18 17:24:51 +02:00
parent 7d12dbcc65
commit 3312ab2143
1 changed files with 6 additions and 1 deletions

View File

@ -49,7 +49,7 @@ from common.fuzzyclock import FuzzyClock
from htmltextview import HtmlTextView
from common.exceptions import GajimGeneralException
from common.exceptions import LatexError
from encodings.punycode import punycode_encode as puny_encode
NOT_SHOWN = 0
ALREADY_RECEIVED = 1
@ -1165,6 +1165,11 @@ class ConversationTextview(gobject.GObject):
# convert all names to TextTag
all_tags = [(ttt.lookup(t) if isinstance(t, str) else t) for t in all_tags]
buffer_.insert_with_tags(end_iter, special_text, *all_tags)
if 'url' in tags:
puny_text = puny_encode(special_text)
if not puny_text.endswith('-'):
end_iter = buffer_.get_end_iter()
buffer_.insert(end_iter, " (%s)" % puny_text)
def print_empty_line(self):
buffer_ = self.tv.get_buffer()