When doing a #switch or #ifeq on a {{PAGENAME}} argument, and page title contains an apostrophe (for example, [[L'Aquila]]), it doesn't match correctly. For example:
{{#switch:{{PAGENAME}} |L'Aquila = OK |L&Aquila = "Unexpected match" }}
doesn't return "OK", but "Unexpected match". I tested on en.wikipedia and it.wikipedia.
Note that the following correctly returns "OK":
{{#switch:L'Aquila |L'Aquila = OK |L&Aquila = "Unexpected match" }}
And {{PAGENAME}} alone correctly returns "L'Aquila" if you display it on a rendered wiki page, but together they don't work... Normally the HTML-encoding should NEVER be performed by any builting parser function, it should only occur in the final stage of Mediawiki, after the full template expansions and transclusions and processing of all parser functions and magic keywords, during the conversion of the wiki code to HTML (and its beautification with HTML-tidy).
Mising the processing layers creates later other ambiguities and can potentially create new unexpected collisions between strings that are normally distinct only in one layer or the other. Suich collisions could generate some security risks, or could allow some attackers to avoid some protection or detection mechanisms, or could forbid some Wiki maintenance tools to work properly.
So the fix proposed in #ifeq: and #switch: (HTML-decode their input parameters to compare) is only a weak work-around (that creates new problems by adding new risks of collisions).
The real fix should be to drop the incorrect HTML-encoding of what "(BASE/SUB/FULL)(PAGE/SUBJECT/TALK)NAME" parser functions return: this should be the unaltered Wiki page name (without any HTML-escaping or URL-escaping); the URL-escaping is only use in "[BASE/SUB/FULL](PAGE/SUBJECT/TALK)NAMEE".
The HTML-escaping is clearly undesirable, these parser functions are not named "[BASE/SUB/FULL](PAGE/SUBJECT/TALK)NAMEH"
Version: 1.19
Severity: enhancement
OS: Windows XP
Platform: PC
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=67196