[Mediawiki-l] Converting "_" to "%20" in file:/// url

Kushal Koolwal kushalkoolwal at hotmail.com
Fri Nov 6 18:57:31 UTC 2009


MediaWiki: 1.12
Host OS: Linux

Most of our intranet mediawiki users are very non-technical. We link to a lot of file that resides on Windows shared network drive in our mediawiki articles. There are hundreds and hundreds of such files. These files and their paths have "spaces" in them which needs to be converted into their ASCII equivalent of "%20".

Using {{urlencode}} does not work because it converts "spaces" into "+" character according to RFC1738.

Right now I am using string replacement extension and created a template called "Delspace" with following function:

{{#replace:{{{1}}}| |%20}}

and I am using the template in our wiki articles like this (for example):
[{{delspace|file///Z:/my project/final results.pdf}} Link to results.pdf]

The above works but as I mentioned before, most of the users are non-technical (word doc types) and it is kind of cumbersome for them to use the above template every time they need to put a link to a document.

So my question(s) is:
1. Basically I am looking for is a way in which the users won't have to
use the template manually every time they need to put a link to a
document which have "spaces".


2. Alternatively, is there a way by which all the file:/// urls in a wiki article which have "spaces" get automatically converted into proper urls (with %20 instead of "spaces") when the user hits the "Save Page" button?

Any other better solution is also welcomed.

Kushal Koolwal

I do blog at http://blogs.koolwal.net/
 		 	   		  
_________________________________________________________________
Windows 7: Unclutter your desktop.
http://go.microsoft.com/?linkid=9690331&ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen:112009


More information about the MediaWiki-l mailing list