From 205f7a504bc73dc86fcaa5a593d7b6a426112223 Mon Sep 17 00:00:00 2001 From: euromark Date: Fri, 27 Sep 2013 14:56:53 +0200 Subject: [PATCH] also fix autoLinkEmail() --- lib/Cake/Test/Case/View/Helper/TextHelperTest.php | 5 +++++ lib/Cake/View/Helper/TextHelper.php | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php index 1bb27f465..e620c13b9 100644 --- a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php @@ -359,6 +359,11 @@ class TextHelperTest extends CakeTestCase { $expected = 'Text with email@example.com address'; $result = $this->Text->autoLinkEmails($text, array('class' => 'link')); $this->assertRegExp('#^' . $expected . '$#', $result); + + $text = 'Text with düsentrieb@küchenschöhn-not-working.de address'; + $expected = 'Text with düsentrieb@küchenschöhn-not-working.de address'; + $result = $this->Text->autoLinkEmails($text); + $this->assertRegExp('#^' . $expected . '$#', $result); } /** diff --git a/lib/Cake/View/Helper/TextHelper.php b/lib/Cake/View/Helper/TextHelper.php index 96d6d7098..b979ec617 100644 --- a/lib/Cake/View/Helper/TextHelper.php +++ b/lib/Cake/View/Helper/TextHelper.php @@ -186,9 +186,9 @@ class TextHelper extends AppHelper { $options += array('escape' => true); $this->_placeholders = array(); - $atom = '[a-z0-9!#$%&\'*+\/=?^_`{|}~-]'; + $atom = '[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]'; $text = preg_replace_callback( - '/(' . $atom . '+(?:\.' . $atom . '+)*@[a-z0-9-]+(?:\.[a-z0-9-]+)+)/i', + '/(' . $atom . '+(?:\.' . $atom . '+)*@[\p{L}0-9-]+(?:\.[a-z0-9-]+)+)/ui', array(&$this, '_insertPlaceholder'), $text );