Last modified: 2014-10-30 20:19:26 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 T74774, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 72774 - Can't use underscore in page titles
Can't use underscore in page titles
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.25-git
All All
: Unprioritized major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-30 19:33 UTC by teo8976
Modified: 2014-10-30 20:19 UTC (History)
1 user (show)

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


Attachments

Description teo8976 2014-10-30 19:33:11 UTC
There's no way to create a page with an underscore in its title.
Underscores are treated incorrectly because
1) Spaces in titles are encoded as underscores
2) There's no way to "escape" an underscore.

Hence, here are a few example of epic fails:
1) In a page, write [[My_New_Page]]
=> this will be rendered as a link that reads My_New_Page which links to creating a page
2) click the link, edit and save the page
3) Now in the original page, write [[My New Page]]

expected: the title of the saved page should be "My_New_Page". This page should be distinguishable from a page whose title is "My New Page". The link [[My New Page]] should link to a still-to-be-created page titled "My New Page" which would not be the same as "My_New_Page". If at all needed, a mechanism for escaping undersores should be provided.

observed: the page that you create as "My_New_page" is actually saved as a page whose title is "My New Page". Both [[My_New_page]] and [[My New Page]] link to the same page, which is titled "My New Page". There's no such thing as a page with underscores in the title, and that's wrong. If you try to rename (i.e. move) the page "My New Page" to "My_New_Page", it will issue an error saying a page cannot be moved onto itself.
Comment 1 Bartosz Dziewoński 2014-10-30 19:40:31 UTC
This is the expected behavior.

You can use the DISPLAYTITLE: parser function to override the displayed page title, for example to display it with underscores instead of spaces. Currently this only affects the page heading and title, there's a feature request for this modified title to be used consistently everywhere (bug 24139).

    {{DISPLAYTITLE:My_New_Page}}

https://www.mediawiki.org/wiki/Help:Magic_words#Displaytitle

(For a practical example, see e.g. [[mod_perl]] on the English Wikipedia.)
Comment 2 teo8976 2014-10-30 20:19:26 UTC
Good to know there's a workaround, but it's still a wrong approach. 

Also note that if you still want to maintain this approach (i.e. considering "_" and " " as the same character in titles), then at the very least a warning should be given when creating a page. Yeah, that's not trivial, because when the page is actually created there's almost no way to "know" the link that lead to its creation had an underscore. Which shows once more that the approach is wrong in the first place.

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


Navigation
Links