Forum:Can PAGENAME return underscores?

I am trying to code a template so that it will link to a URL that mirrors a page on an external wiki using the same title.

The problem is that when PAGENAME (using the double paired moustache brackets like for templates) is used, the string it returns uses spaces instead of underscores.

While this may often be preferable in many cases, I would prefer underscores in this instance, like how it appears in URLs. The reason is I am using it in a single square-bracketed link.

Like for example, if I use a template with PAGENAME on a page title "the world", the string placed in the URL is "the" and "world" instead becomes the first word that is used for the title of the link, instead of continuing the URL.

So so far, this limits PAGENAME's use in templates for me to be for single-world links that do not include spaces, and this limits the usefulness as there are many multiple-word articles I'd like to use it on.

If anyone knows a potential solution for this problem I would be most appreciative if you could contact me on my talk, otherwise I'll check intermittantly. +y@talk 04:41, April 11, 2012 (UTC)


 * There's also a URL-encoded version: . Example:.


 * OMG this works, thank you! +y@talk 13:15, April 12, 2012 (UTC)


 * works best, but you could also use #replace to replace spaces with _,  &rarr;
 * I use this for cases where I want to replace spaces with + to pass on to some external search engine thingy:  &rarr;  -- Fandyllic  (talk &middot; contr) 12 Apr 2012 9:52 AM Pacific