Tweak URI detection RE to capture non-ascii symbols. Fixes #5675

This commit is contained in:
Alexander Cherniuk 2010-03-26 21:17:11 +02:00
parent aed9179d15
commit 48cd4d796a
1 changed files with 3 additions and 3 deletions

View File

@ -2461,8 +2461,7 @@ class Interface:
# FIXME: recognize xmpp: and treat it specially # FIXME: recognize xmpp: and treat it specially
links = r"((?<=\()[A-Za-z][A-Za-z0-9\+\.\-]*:"\ links = r"((?<=\()[A-Za-z][A-Za-z0-9\+\.\-]*:"\
r"([\w\.\-_~:/\?#\[\]@!\$&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+"\ r"([\w\.\-_~:/\?#\[\]@!\$&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+"\
r"(?=\)))|([A-Za-z][A-Za-z0-9\+\.\-]*:([\w\.\-_~:/\?#\[\]@!\$"\ r"(?=\)))|(\w[\w\+\.\-]*:(\S|%[A-Fa-f0-9]{2})+)"
r"&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+)"
# 2nd one: at_least_one_char@at_least_one_char.at_least_one_char # 2nd one: at_least_one_char@at_least_one_char.at_least_one_char
mail = r'\bmailto:\S*[^\s\W]|' r'\b\S+@\S+\.\S*[^\s\W]' mail = r'\bmailto:\S*[^\s\W]|' r'\b\S+@\S+\.\S*[^\s\W]'
@ -2479,7 +2478,8 @@ class Interface:
basic_pattern = links + '|' + mail + '|' + legacy_prefixes basic_pattern = links + '|' + mail + '|' + legacy_prefixes
link_pattern = basic_pattern link_pattern = basic_pattern
self.link_pattern_re = re.compile(link_pattern, re.IGNORECASE) self.link_pattern_re = re.compile(link_pattern, re.IGNORECASE |
re.UNICODE)
if gajim.config.get('use_latex'): if gajim.config.get('use_latex'):
basic_pattern += latex basic_pattern += latex