00858: Broken wiki link for href with UTF-8 characters

Summary: Broken wiki link for href with UTF-8 characters
Created: 2007-01-06 19:41
Status: Closed : fixed in 2.2.0-beta55
Category: Bug
From: MarkS
Assigned:
Priority: 55
Version: 2.1.26
OS: WinXP/Apache/4

Description:

  • I override LinkPage and return a string of my choosing and it goes bad!! (Notice the href link get's messed up)
    • This fails
<a class="wikilink" href="./pub/web/Main_%c4llitJaT%e4llit.html">ÄllitJaTällit</a>

<a class="wikilink" href="./pub/web/Main_%c4llitJaT%e4llit.html">ÄllitJaTällit</a>

  • This works
<a class="wikilink" href="http://www.something.com/pub/web/Main_%c4llitJaT%e4llit.html">ÄllitJaTällit</a>

<a class="wikilink" href="http://www.something.com/pub/web/Main_%c4llitJaT%e4llit.html">ÄllitJaTällit</a>

  • And this works
<a class="wikilink" href="./pub/web/Main_Something.html">ÄllitJaTällit</a>

<a class="wikilink" href="./pub/web/Main_Something.html">ÄllitJaTällit</a>

  • Notice normal how the normal wiki link tag works below?
    • This works
[[Main/ÄllitJaTällit]]

ÄllitJaTällit?

  • This fails, notice no output.
[[./pub/web/Main_%c4llitJaT%e4llit.html | ÄllitJaTällit]]

  • This fails.
[[Path:./pub/web/Main_%c4llitJaT%e4llit.html | ÄllitJaTällit]]

ÄllitJaTällit

  • Yet this succeeds
[[http://www.something.com/pub/web/Main_%c4llitJaT%e4llit.html | ÄllitJaTällit]]

ÄllitJaTällit

  • What is the problem????
    • It has something to do with wikistyles.php. If I remove this file it works.
    • I could be wrong though I think one of the following wikistyles.php lines will have to change;
      • SDV($WikiStylePattern,'%%|%[A-Za-z][-,=:#\\w\\s\'"().]*%');
      • $x = preg_replace("/\\bhttps?:[^$UrlExcludeChars]+/e", "Keep('$0')", $x);

Take a look at this post on the list as well as at Cookbook.As spaced function in UTF-8. --Petko February 04, 2007, at 11:12 AM

  • I created a work around so as to use relative urls in my wiki links. --MarkS
    
    if (IsEnabled($EnableWikiStyles,1)){
    	DisableMarkup("%%");
    	Markup('%StylesMarkupThatPlaysNice%','style','%','return ApplyStylesWhenAppropriate($x);');
    }
    
    
    function ApplyStylesWhenAppropriate($x){
    	global $UrlExcludeChars;
    	$x = preg_replace("/\\bhttps?:[^$UrlExcludeChars]+|\\.\\/[^$UrlExcludeChars]+/e", "Keep('$0')", $x);
    	return ApplyStyles($x);
    }