User:Tamzin/urlencode

''I have discovered a minor glitch in a certain combination of magic words. I am not sure how far it extends, but the most relevant effect I've found so far is in userboxes that are intended to link to a URL containing the username of the user whose page they're placed on. The most frequent and significant occurrence of this is user-right userboxes. Below is a demonstration of the error, using a substituted and un-categorized version of my own rollback userbox as an example.''

In the current version, clicking "verify" takes you to the wrong link for any users with ampersands in their names. This is a problem for any user who a) has an ampersand in their username and b) is not the first user, alphabetically, to have a name starting with the string of characters up to and including the ampersand (I've created the account User:Francophonie&Aardvark so as to make myself such a user, for demonstrative purposes). This happens because {{tld|urlencode:{{tld|BASEPAGNAME}} percent-encodes the HTML of the username, instead of the plain text. This userbox now conflates me with an aardvark:

{{userbox }}{{clear}} ("Verify" link: http://en.wikipedia.org/w/index.php?title=Special:ListUsers&limit=1&username=Francophonie%26%2338%3BAndrophilie)
 * border-c = #999
 * id      = Wikipedia Rollbacker.svg
 * id-c    = #DDD
 * info    = {{#ifeq:{{{s}}}|yes| }}This user has rollback rights on the {{#if:|{{{1}}}|English Wikipedia}}.{{#ifeq:{{{s}}}|yes| }} {{#if:| ([{{fullurl:en:Special:ListUsers|limit=1&username={{urlencode:Francophonie&#38;Androphilie}}}} verify{{#if:| {{{lang_code}}}|}} ]) | ([{{fullurl:Special:ListUsers|limit=1&username={{urlencode:Francophonie&#38;Androphilie}}}} verify ]) }}
 * info-c  = #EEE
 * nocat   =
 * usercategory =

The solution is to use {{tld|BASEPAGENAMEE}} (with an extra E at the end) instead of {{tld|urlencode:{{tld|BASEPAGENAME}}}}. See? I am no longer an aardvark!:

{{userbox }}{{Clear}} ("Verify" link: http://en.wikipedia.org/w/index.php?title=Special:ListUsers&limit=1&username=Francophonie%26Androphilie)
 * border-c = #999
 * id      = Wikipedia Rollbacker.svg
 * id-c    = #DDD
 * info    = {{#ifeq:{{{s}}}|yes| }}This user has rollback rights on the {{#if:|{{{1}}}|English Wikipedia}}.{{#ifeq:{{{s}}}|yes| }} {{#if:| ([{{fullurl:en:Special:ListUsers|limit=1&username={{BASEPAGENAMEE}}}} verify{{#if:| {{{lang_code}}}|}} ]) | ([{{fullurl:Special:ListUsers|limit=1&username={{BASEPAGENAMEE}}}} verify ]) }}
 * info-c  = #EEE
 * nocat   =
 * usercategory =