Forum:Why switch doesn't work with PAGENAME

The templates below import following template: It seems that if you fill parameter with string that contains: ', manually it will work, but if you do it with PAGENAME it won't. In the same time if string doesn't contains ', it will work normally in both cases. Look at the source codes for better understanding.
 * Template:Im'provisation
 * Template:Improvisation 2

Whoa. That's pretty bizarre. I've fiddled with those templates and I can't see anything overtly wrong; hell, even this doesn't seem to work: I did find a workaround though, THIS works:

...

Okay, I just searched Google and found these: It's a parser bug in MediaWiki. You can fix it like this: (&amp;#39; is a HTML Entity, 39 is the Unicode/ANSI/ASCII code for an apostrophe). Be aware that handling apostrophes is glitchy as heck because of the bug I linked to above, there are about 5 (if not more that I can't think of right now) different ways of encoding an apostrophe so it is very easy to break a naive template. Lunarity 04:12, August 9, 2012 (UTC)
 * http://www.mediawiki.org/wiki/Help_talk:Extension:ParserFunctions#.23switch.2F.23ifeq_with_apostrophes
 * http://www.mediawiki.org/wiki/Help:Magic_words#URL_encoded_page_names
 * https://bugzilla.wikimedia.org/show_bug.cgi?id=35628

Thanks!