Last modified: 2009-12-19 23:45:21 UTC
The link “more results” at the bottom of the table: The Special:Ask doesn’t found a result. The inline query is {{#ask: [[Catégorie:Communes]] [[Commune lorrain::+]] … }} and if I edit the query in the special page, I found : [[Catégorie:Communes]] [[Commune lorrain::_]]. The “+” is replaced with “_”. The problem can be viewed online at: http://wiki.culture-langues-lorraine.org/Test Version of SMW used: 1.4.2 Version of MW used: 1.15.1 Server setup used: PHP 5.2.6 (cgi), MySQL 4.0.27 The problem is not reproducible on a test page on the sandbox site.
This seems to be a configuration problem with your site/server/wiki. The further results URL that is generated is correct: http://wiki.culture-langues-lorraine.org/Sp%C3%A9cial:Ask/-5B-5BCat%C3%A9gorie:Communes-5D-5D-20-5B-5BCommune-20lorrain::%2B-5D-5D/-3FLatitude/-3FLongitude It contains a properly encoded "+" (the "%2B" after "lorrain::"). However, when trying to call this URL on your site, the "%2B" is substituted by an underscore, leading to a broken query. I can see that one would substitute "+" with "_" in some cases, since "+" was used to encode space in old MediaWiki versions. But there is no reason to also substitute "%2B" with "_". I am not sure what causes this problem. Your MW and SMW versions are fairly recent. Maybe there is a configuration option for MW to fornce this behavior? But the problem could also be in your webserver configuration: if the webserver somehow decodes "%2B" into "+" earlier, then MW would probably do the undesired replacement of "+" with "_" thereafter.
The problem seems to come from the mod_rewrite. It automatically decodes the urlencoded URL, so if you pass in %2B, PHP sees it as "+", a space that mediawiki converts to an underscore. If I double encode "+" (%252B), mod_rewrite decodes the first one, and PHP receives the second one (which is now %2B). Example: [http://wiki.culture-langues-lorraine.org/Sp%C3%A9cial:Ask/-5B-5BCat%C3%A9gorie:Communes-5D-5D-20-5B-5BCommune-20sobriquet-20lorrain::%252B-5D-5D/-3FCode-20postal/-3FCommune-20sobriquet-20lorrain%3DSobriquet%28s%29] (In reply to comment #1) > This seems to be a configuration problem with your site/server/wiki. The > further results URL that is generated is correct: > > http://wiki.culture-langues-lorraine.org/Sp%C3%A9cial:Ask/-5B-5BCat%C3%A9gorie:Communes-5D-5D-20-5B-5BCommune-20lorrain::%2B-5D-5D/-3FLatitude/-3FLongitude > > It contains a properly encoded "+" (the "%2B" after "lorrain::"). However, when > trying to call this URL on your site, the "%2B" is substituted by an > underscore, leading to a broken query. I can see that one would substitute "+" > with "_" in some cases, since "+" was used to encode space in old MediaWiki > versions. But there is no reason to also substitute "%2B" with "_". > > I am not sure what causes this problem. Your MW and SMW versions are fairly > recent. Maybe there is a configuration option for MW to fornce this behavior? > But the problem could also be in your webserver configuration: if the webserver > somehow decodes "%2B" into "+" earlier, then MW would probably do the undesired > replacement of "+" with "_" thereafter.
As I haven’t found a good solution with Apache, I have fixed temporary the problem by modifying the source code of the function SMWInfolink:: encodeParameters(…), line 264 : $value = str_replace(array('-', '#', "\n", ' ', '/', '[', ']', '<', '>', '<', '>', '&', '\'\'', '|', '&', '%', '?', '+'), array('-2D', '-23', '-0A', '-20', '-2F', '-5B', '-5D', '-3C', '-3E', '-3C', '-3E', '-26', '-27-27', '-7C', '-26', '-25', '-3F', '-2B'), $value); I think you should add a global variable to parametrize this ?