Page MenuHomePhabricator

Header "x :" includes a NBSP between x and colon
Closed, InvalidPublic

Description

When I write a normal level-2 header in wikitext with the text "x :", and then inspect the content of the resulting HTML element, I find that its textContent is "x", then a nbsp, then a ":". This is unexpected: I would normally think a normal space in the wikitext would result in a normal space in the HTML.

Event Timeline

APerson created this task.Aug 19 2018, 4:58 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 19 2018, 4:58 AM

Possible explanation proposed by Brion on Mastodon, from https://mastodon.technology/@brion/100575141289871028: "there's some nbsp replacement around certain punctuation to handle patterns common in French"

TTO closed this task as Declined.Aug 19 2018, 7:10 AM
TTO added a subscriber: TTO.

There is a function in MediaWiki called armorFrenchSpaces which does this. It's clearly intended behaviour, and I would even argue that it is correct behaviour for all languages (other than programming languages, perhaps). See https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/parser/Sanitizer.php$1146

Aklapper renamed this task from Mysterious NBSP appearing in header to Header "x :" includes a NBSP between x and colon.Aug 19 2018, 7:59 AM
Aklapper changed the task status from Declined to Invalid.