Last modified: 2011-02-01 09:39:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T24474, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22474 - urlencode should take an optional second parameter
urlencode should take an optional second parameter
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy
: 16868 24434 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-11 01:42 UTC by Conrad Irwin
Modified: 2011-02-01 09:39 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Conrad Irwin 2010-02-11 01:42:42 UTC
There are a few related bugs, but none seem to address this issue directly (that or I have Zarro Bug Foo).

{{urlencode:Hello world}} -> Hello+World

{{urlencode:Hello world|path}} -> Hello%20World

{{urlencode:Hello world|wiki}} -> Hello_World

{{urlencode:Hello world|query}} -> Hello+World


Maybe better to use format=path or for=path for clarity?
Comment 1 Conrad Irwin 2010-04-08 00:30:23 UTC
*** Bug 16868 has been marked as a duplicate of this bug. ***
Comment 2 Conrad Irwin 2010-04-08 00:31:10 UTC
Implemented as described in r64726
Comment 3 Umherirrender 2010-04-08 17:45:53 UTC
Wiki encoding works fine with FULLPAGENAMEE:

{{urlencode:Hello world|wiki}} <=> {{FULLPAGENAMEE:Hello world}}

Maybe there is no need for a new function.
Comment 4 Conrad Irwin 2010-04-08 18:09:34 UTC
Not quite, though I appreciate the difference is confusing: FULLPAGENAMEE validates its input for MediaWiki, urlencode does not. Perhaps "WIKI" was a confusing choice of name, but this is really useful for other sites that use an _ for encoding spaces (MediaWiki itself can understand |path}} encoding).

"{{urlencode:<b>|wiki}}" = "%3Cb%3E"
"{{FULLPAGENAMEE:<b>}}" = ""

"{{urlencode:&amp;|WIKI}}" = "%26amp;"
"{{FULLPAGENAMEE:&amp;}}" = "&"

Maybe, given that the difference is just how they encode spaces, it should be |+}} |%}} and |_}} - but that seems a bit leet, and is inflexible if someone wants to add other conventions.

It might also be nice to add a further flag for decoding HTML entities, and/or %-escapes.
Comment 5 Niklas Laxström 2010-07-18 16:00:10 UTC
*** Bug 24434 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links