Last modified: 2012-05-01 19:36:03 UTC
The function titlePartToKey in the class ApiQueryBase doesn't work correctly in the presence of the # character in the $titlePart paramter: the last character from the correct keyPart is removed. So, for example "WikiProject#" is converted to "WikiProjec". This is because of the way the function tries to keep trailing spaces by appending "x" to the title and then removing it from the resulting key. The problem happens because titleToKey correctly removes everything after the # and substr then incorrectly removes some other character. This happens for example in the query http://en.wikipedia.org/w/api.php?format=xml&action=query&list=allpages&apnamespace=4&apprefix=WikiProject%23 which lists all pages in the namespace 4 whose name starts with WikiProjec (without t). (Note: The # character has to be URL-encoded as %23 in the URL, otherwise browsers will treat it as an anchor.)
Page titles cannot contain #, therefore it makes no sense to query for that. But you are right, the api should work correct with that and not strip a character.
Yeah. Now that I think about it, returning an error might make some sense in this case. Although it would be inconsistent with other modules that accept titles.