I tested too mediaWiki encoding with js encodeURI() function. I found a difference, only one, since mediaWiki encodes apostrophe while encodeURI() doesn't. Obviously the second, great difference is the conversion of spaces into underlines.
So, in js so far I got a good simulation of localurl: Mediawiki encoding with this: encodeURI(string.replace(/ /g,"_")).replace(/%27/g,"'") )
(the last string is an apostrophe between double quotes)
Is there some reason why wiki encoding is different from js encodeURI (that, I presume, is founded on a standard)? I found this a little confusing.
Alex