https://bugzilla.wikimedia.org/show_bug.cgi?id=28722

             Bug #: 28722
           Summary: mw.util.wikiUrlencode inconsistent with parser output
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Unprioritized
         Component: Javascript
        AssignedTo: wikibugs-l@lists.wikimedia.org
        ReportedBy: russb...@hotmail.com
                CC: tpars...@wikimedia.org
    Classification: Unclassified


Although this function (mw.util.wikiUrlencode) does "Encode page titles for use
in a URL", it would be much more useful if it produced the same encoding as the
MediaWiki parser does internally.  For example, this would make it useful in
jQuery selectors to select the <a> elements corresponding to particular page
titles.  Where the encodings do not match up, the selector will not find the
element.

One such discrepancy is, on Wikipedia, the parser converts the link [[union]]
into the HTML code <a href="/wiki/Union">union</a>; but
mw.util.wikiUrlencode("union") returns "union" (lowercase).

Other inconsistencies:  

wikiUrlencode does not collapse multiple spaces/underscores
(mw.util.wikiUrlencode("United   States") returns "United___States", but the
parser produces <a href="/wiki/United_States">United States</a>; 

wikiUrlencode converts (at least) the following characters to their
percent-encoded equivalents, but the parser does not: !@$%^()=

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to