[smuxi: 11/12] Engine(-Tests): support internationalized domain names (IDN) for link detection



commit d0cae01e773c7047e3fb8bd4b36975f59c6b6ae5
Author: Mirco Bauer <meebey meebey net>
Date:   Tue Sep 1 12:41:24 2015 +0200

    Engine(-Tests): support internationalized domain names (IDN) for link detection

 src/Engine-Tests/MessageBuilderTests.cs     |   10 ++++++++++
 src/Engine/Config/MessageBuilderSettings.cs |    4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/Engine-Tests/MessageBuilderTests.cs b/src/Engine-Tests/MessageBuilderTests.cs
index c49dfa0..74ba179 100644
--- a/src/Engine-Tests/MessageBuilderTests.cs
+++ b/src/Engine-Tests/MessageBuilderTests.cs
@@ -608,6 +608,16 @@ namespace Smuxi.Engine
         }
 
         [Test]
+        public void AppendMessageWithIdnLink()
+        {
+            var msg = "http://www.brasileirão.com";;
+            var builder = new MessageBuilder();
+            builder.TimeStamp = DateTime.MinValue;
+            builder.Append(new UrlMessagePartModel(msg));
+            TestMessage(msg, builder.ToMessage());
+        }
+
+        [Test]
         public void AppendMessageWithSmartLinks()
         {
             var msg = "RFC2812";
diff --git a/src/Engine/Config/MessageBuilderSettings.cs b/src/Engine/Config/MessageBuilderSettings.cs
index 0dd15b4..f49c33a 100644
--- a/src/Engine/Config/MessageBuilderSettings.cs
+++ b/src/Engine/Config/MessageBuilderSettings.cs
@@ -72,8 +72,8 @@ namespace Smuxi.Engine
         {
             string path_last_chars = @"a-zA-Z0-9#/%&@=\-_+;:~'";
             string path_chars = path_last_chars + @"\(\)\[\]\{\}?!.,";
-            string domainchars = @"[a-z0-9\-]+";
-            string subdomain = domainchars + @"\.";
+            string domain_chars = @"[a-z0-9\-\p{L}]+";
+            string subdomain = domain_chars + @"\.";
             string common_tld = @"de|es|im|us|com|net|org|info|biz|gov|name|edu|onion|museum";
             string any_tld = @"[a-z]+";
             string ip6 = @"(?:[0-9a-f]{0,4}:){1,7}[0-9a-f]{1,4}";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]