Author Topic: Href links with percents (%D0%9D) cuts on first percent  (Read 1885 times)

Murz

  • Full Member
  • ***
  • Posts: 147
    • View Profile
Href links with percents (%D0%9D) cuts on first percent
« on: December 11, 2009, 03:29:13 am »
I have a link in note:
http://ru.wikipedia.org/wiki/%D0%9D%D0%B8%D0%B6%D0%BD%D0%B8%D0%B9
and OpenGoo detect this link as
<a href="http://ru.wikipedia.org/wiki/" target="_blank">http://ru.wikipedia.org/wiki/</a>%D0%9D%D0%B8%D0%B6%D0%BD%D0%B8%D0%B9

The link cuts at first percent symbol.

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Href links with percents (%D0%9D) cuts on first percent
« Reply #1 on: December 14, 2009, 11:42:18 am »
Fixed for next release. Edit file 'environment/functions/general.php' lines 570-574, change from:

Code: [Select]
//Replace full urls with hyperinks. Avoids " character for already rendered hyperlinks
$text = preg_replace('@([^"\']|^)(https?://([-\w\.]+)+(:\d+)?(/([\w/_\-\.\+]*(\?[^\s<]+)?)?)?)@', '$1<a href="$2" target="_blank">$2</a>', $text);

//Convert every word starting with "www." into a hyperlink
$text = preg_replace('@(>|\s|^)(www.([-\w\.]+)+(:\d+)?(/([\w/_\-\.\+]*(\?[^\s<]+)?)?)?)@', '$1<a href="http://$2" target="_blank">$2</a>', $text);

to:

Code: [Select]
//Replace full urls with hyperinks. Avoids " character for already rendered hyperlinks
$text = preg_replace('@([^"\']|^)(https?://([-\w\.]+)+(:\d+)?(/([%\w/_\-\.\+]*(\?[^\s<]+)?)?)?)@', '$1<a href="$2" target="_blank">$2</a>', $text);

//Convert every word starting with "www." into a hyperlink
$text = preg_replace('@(>|\s|^)(www.([-\w\.]+)+(:\d+)?(/([%\w/_\-\.\+]*(\?[^\s<]+)?)?)?)@', '$1<a href="http://$2" target="_blank">$2</a>', $text);

(Added a % sign before the second occurrence of \w in both lines that start with $text)