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

Katharina Wolkwitz wolkwitz at fh-swf.de
Tue Nov 10 07:04:56 UTC 2009


Hi Kushal,

have you thought about using the filelink-Extension?

With that extension, your users can choose which file the want to make a link to
and the extension does the rest...

Greetings
Katharina

Kushal Koolwal schrieb am 06.11.2009 19:57:
> 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/



More information about the MediaWiki-l mailing list