Last modified: 2011-03-13 18:05:39 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 T15016, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 13016 - Anchor encoding is not one-to-one
Anchor encoding is not one-to-one
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
http://www.mediawiki.org/wiki/User:Si...
:
Depends on:
Blocks: html
  Show dependency treegraph
 
Reported: 2008-02-14 02:12 UTC by Aryeh Gregor (not reading bugmail, please e-mail directly)
Modified: 2011-03-13 18:05 UTC (History)
1 user (show)

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


Attachments

Description Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-02-14 02:12:58 UTC
Due to the way we do anchor encoding, there's no way to reliably reverse it.  ".3F", for instance, is translated to ".3F", but so is "?".  And both "_" and " " become "_".  It would be nice if anchor encoding were made reversible to avoid unintended conflicts and permit anchor decoding facilities.

Currently we do, roughly

$id = str_replace( ' ', '_', $id );
$id = Sanitizer::decodeCharReferences( $id );
$id = urlencode( $id );
$id = str_replace( '%3A', ':', $id );
$id = str_replace( '%', '.', $id );

This should be

$id = Sanitizer::decodeCharReferences( $id );
$id = urlencode( $id );
$id = str_replace( '_', '%5F', $id );
$id = str_replace( '.', '%2E', $id );
$id = str_replace( '%20', '_', $id );
$id = str_replace( '%3A', ':', $id );
$id = str_replace( '%', '.', $id );

That could then be reversed reliably (to within entity encoding) with

$id = str_replace( '.', '%', $id );
$id = str_replace( '_', ' ', $id );
$id = urldecode( $id );
Comment 1 Aryeh Gregor (not reading bugmail, please e-mail directly) 2009-01-05 16:04:52 UTC
The new encoding scheme we use is deliberately not one-to-one, so that the anchors look nicer: invalid characters (mostly punctuation) are converted into underscores for prettiness.  WONTFIX.

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


Navigation
Links