Page MenuHomePhabricator

{{PAGENAMEE}} inconsistantly encodes 'space' for no good reason.
Closed, InvalidPublic

Description

Author: dan

Description:
A page called 'One Two Three' is encoded as 'One_Two_Three' by {{PAGENAMEE}},
which is fine for internal (self referential) links to 'this' page in the
current or another wiki, but isn't adequate for 'dynamic' links to google for
example.

So [http://www.google.com/search?q={{PAGENAMEE}} search this page on Google]
doesn't work like it should.

If {{PAGENAMEE}} instead produced 'One%20%Two%20Three' or 'One+Two+Three', it
would still work with 'internal' links within and between wiki's, but would also
work in the 'google' context above.

The code looks like this...

$t->mDbkeyform = str_replace( ' ', '_', $title );
$t->mArticleID = ( $ns >= 0 ) ? -1 : 0;
$t->mUrlform = wfUrlencode( $t->mDbkeyform );

When it could better just look like this...

$t->mUrlform = wfUrlencode( $title );

Thanks to the IRC people for helping me with this bug report.


Version: unspecified
Severity: normal

Details

Reference
bz3650

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:51 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz3650.
bzimport added a subscriber: Unknown Object (MLST).

gangleri wrote:

please take a look at bug 707: Google search with [[Google:search term]]

{{PAGENAMEE}} makes a lot of usefull character conversion and is used often in
the parameter part of URL's. {{PAGENAMEE}} should not be changed for the Google
search. I think it would be best to have another solution as another variable or
an extension.

Best regards Reinhardt [[user:gangleri]]

avarab wrote:

(In reply to comment #1)

{{PAGENAMEE}} makes a lot of usefull character conversion and is used often in
the parameter part of URL's. {{PAGENAMEE}} should not be changed for the Google
search. I think it would be best to have another solution as another variable or
an extension.

This bug is about making PAGENAMEE return "+" for spaces rather than "_" which
should as far as I know work, in what cases would it not work and break current
use of the variable in which case we need a seperate variable for this
functionality.

gangleri wrote:

It will brake {{SERVER}}{{localurl:category:foo|from={{PAGENAMEE}}}} at pages
with nontrivial names (containing spaces and non 7 bit ASCII characters).

PAGENAMEE is specifically for wiki page titles, so that's how they're formatted.

Ok then, maybe we should have PAGENAMEU for the url-encoded version?