[Home]WikiBugs/UrlEncoding

UseModWiki | WikiBugs | RecentChanges | Preferences

Fixed in 1.0.3 --MarkusLude

In RecentChanges or RSS feeds LocalWiki:action=rss certain characters in urls must be encoded to %xx (see RFC 2396). This is in particular necessary if a Wiki name contains iso-8859-1 umlauts. The following patch corrects it for the recent changes RSS feed. However - it should also be corrected in the usual RecentChanges.

Note that browsers usually do this conversion, but sometimes they can't do it right: I got that RSS feed with iso-8859-1 umlaut urls into a utf-8 portal.

The patch will work if your wiki is configured to iso-latin. It has not been tested for utf-8.

 sub GetRssRcLine{
   my ($pagename, $timestamp, $host, $userName, $userID, $summary,
       $isEdit, $pagecount, $revision, $diffPrefix, $historyPrefix) = @_;
   my ($itemID, $description, $authorLink, $author, $status,
       $importance, $date, $item, $headItem);
 
+  my $pagename_esc = CGI::escape($pagename);
   # Add to list of items in the <channel/>
   $itemID = $FullUrl . &ScriptLinkChar()
-            . &GetOldPageParameters('browse', $pagename, $revision);
+            . &GetOldPageParameters('browse', $pagename_esc, $revision);
   $itemID = &QuoteHtml($itemID);
   $headItem = "                <rdf:li rdf:resource=\"$itemID\"/>\n";
   # Add to list of items proper.
   if (($summary ne "") && ($summary ne "*")) {
     $description = &QuoteHtml($summary);
   }
   $host = &QuoteHtml($host);
   if ($userName) {
     $author = &QuoteHtml($userName);
     $authorLink = "link=\"$QuotedFullUrl?$author\"";
   } else {
     $author = $host;
   }
   $status = (1 == $revision) ? 'new' : 'updated';
   $importance = $isEdit ? 'minor' : 'major';
   $timestamp += $TimeZoneOffset;
   my ($sec, $min, $hour, $mday, $mon, $year) = localtime($timestamp);
   $year += 1900;
   $date = sprintf("%4d-%02d-%02dT%02d:%02d:%02d%s",
     $year, $mon+1, $mday, $hour, $min, $sec, $ServerTimeZone);
   #$date = sprintf("%4d-%02d-%02dT%02d:%02d:%02d+%02d:00",
     #$year, $mon+1, $mday, $hour, $min, $sec, $TimeZoneOffset/(60*60));
   $pagename = &QuoteHtml($pagename);
   # Write it out longhand
   $item = <<RSS ;
     <item rdf:about="$itemID">
         <title>$pagename</title>
-        <link>$QuotedFullUrl?$pagename</link>
+        <link>$QuotedFullUrl?$pagename_esc</link>
         <description>$description</description>
         <dc:date>$date</dc:date>
         <dc:contributor>
             <rdf:Description wiki:host="$host" $authorLink>
                 <rdf:value>$author</rdf:value>
             </rdf:Description>
         </dc:contributor>
         <wiki:status>$status</wiki:status>
         <wiki:importance>$importance</wiki:importance>
-        <wiki:diff>$diffPrefix$pagename</wiki:diff>
+        <wiki:diff>$diffPrefix$pagename_esc</wiki:diff>
         <wiki:version>$revision</wiki:version>
-        <wiki:history>$historyPrefix$pagename</wiki:history>
+        <wiki:history>$historyPrefix$pagename_esc</wiki:history>
     </item>
 RSS
   return ($headItem, $item);
 }

--StefanTrcek

For RecentChanges this was fixed with the WikiPatches/ProperUriEscaping from UngarPeter. -- MarkusLude


UseModWiki | WikiBugs | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited October 30, 2007 3:05 pm by MarkusLude (diff)
Search: