Page MenuHomePhabricator

space char in template parameter is not converted to %20
Closed, ResolvedPublic

Description

Author: nathan_w_cheng

Description:
According to the documentation at

http://meta.wikimedia.org/wiki/Templates#External_links

when a template parameter is part of a URL, any spaces in the value of the parameter are
automatically converted to %20 so that the URL is properly rendered, i.e. the URL is not ended.
However, the examples contained in the documentation demonstrate that this automatic conversion
does _not_ in fact happen--at least in the version of MediaWiki on which the documentation is
running.


Version: 1.4.x
Severity: normal
Platform: PC
URL: http://meta.wikimedia.org/wiki/Templates#External_links

Details

Reference
bz1192
TitleReferenceAuthorSource BranchDest Branch
Group management script improvementsrepos/releng/gitlab-settings!24dancyreview/dancy/group-management-2main
Add group management scriptsrepos/releng/gitlab-settings!23dancyreview/dancy/group-managementmain
Upgrade all buster images to composer 2.5.1repos/releng/dev-images!28jforrestercomposer-2.5.1main
Customize query in GitLab

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:00 PM
bzimport set Reference to bz1192.
bzimport added a subscriber: Unknown Object (MLST).

I'm not sure who wrote that or why, it doesn't seem to be true and I'd be very surprised if it were.

Tested on 1.3.8 and 1.4 current.

Marking... invalid? Not sure. Reopen if you get more information.

nathan_w_cheng wrote:

According to the Meta home page it is running 1.4beta3.

Maybe I am retarded or just sleep-deprived, but did you check out the link in the bug description? The
documentation expressly states that:

"A blank space in a parameter value or template content that is substituted in a URL is not taken as
ending the URL, but converted to %20."

But look at the first example in the "Examples" section that follows this statement. It passes the
parameters:

insert in target
insert in label

to the template:

tle

The template tle is defined as follows:

[http://a{{{1}}}b c{{{2}}}d]

Now, according to the documentation, this should render HTML that looks like this:

<a href="http://ainsert%20in%20targetb">cinsert in labeld</a>

But the html that gets rendered is not even close; it is this:

<a href="http://ainsert">in targetb cinsert in labeld</a>

This is cleary caused by the space chars in the first parameter "insert in target" NOT being replaced by %
20's as they should be and as the documentation claims they are.

(In reply to comment #2)

Maybe I am retarded or just sleep-deprived, but did you

check out the link in the bug description? The

documentation expressly states that:

I certainly did: as I explained, this "documentation" does not
match the observed behavior of the system. I confirmed also
that the observed behavior on 1.4beta3 is the same on 1.3.8.

From this I draw the conclusion that the page's description
probably was not correct before the upgrade either. I
therefore cannot explain why someone wrote that description.
We will require additional information, such as a confirmation
that it really did ever work like that.

nathan_w_cheng wrote:

Oh, I must be sleep-deprived...when you said, "I don't know who wrote that...", I thought you were talking
about me logging this as a bug.

One this is for sure: It sure would be nice if space chars were converted to %20 in URLs. This would make
the templating functionality a lot more useful. See the OtherVersionsExt template embedded on this page:

http://217.160.248.24/randy/wikibible/mediawiki-1.3.7/index.php?title=WikiBibleMerge:Bible_Versions

for an example of where this would be really useful and why I want to use it. The workaround is that I have
to pass two params--one with spaces, one with %20s.

The template replacement doesn't know that you're putting something into a URL.

Resolving as a duplicate of bug 839, an enhancement request for an explicit way to URL-encode things like template
parameters.

  • This bug has been marked as a duplicate of 839 ***