Last modified: 2013-03-25 15:15:50 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 3461 - Syntax extensions: special character, e.g. underscore, for non-breaking space ( )
Syntax extensions: special character, e.g. underscore, for non-breaking space...
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
All All
: Lowest enhancement with 22 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2005-09-14 11:28 UTC by messi
Modified: 2013-03-25 15:15 UTC (History)
8 users (show)

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


Description messi 2005-09-14 11:28:58 UTC
Well written articles need a lot of non-breaking spaces. I'd like to propose
either a double-tilde (~~) or an underscore (_) for this job:

800 km² (800 km²)
--> 800~~km² / 800_km²

12° 34.56' N (12° 34.56' N)
--> 12°~~34.56'~~N / 12°_34.56'_N

July 4th (July 4th)
--> July~~4th / July_4th

Some writers use the shorter en dash – which is then also surrounded
by spaces –...
-->Some writers use the shorter en~~dash –~~which is then also surrounded by
-->Some writers use the shorter en_dash –_which is then also surrounded by
Comment 1 Iaroslav Vassiliev 2005-10-17 22:14:43 UTC
Underscore (_) would be perfect, because it is also easily accessible from any
non-english keyboard layout.
Comment 2 Ævar Arnfjörð Bjarmason 2005-10-17 22:16:22 UTC
There's already a unicode character for a non-breaking space, use that.
Comment 3 Iaroslav Vassiliev 2005-10-17 22:28:41 UTC
(In reply to comment #2)
> There's already a unicode character for a non-breaking space, use that.

It is not easy to copy U+00A0, or to write " ", or to do Alt+0160 every
time nbsp is needed. The idea is to make nbsp input real easy, with one touch
Comment 4 bdk 2005-10-18 01:14:50 UTC
Underscore is already and will be needed as it is mainly meant to, e.g. for 
external links. It may not be possible to divide easily between different 
forms of usage. Imagine the possible wish to use a normal underscore 
_and_ a non-breaking space together in one link.
Therefore the underscore should not be used for this proposal.
Comment 5 dg 2005-10-27 18:59:52 UTC
Non-breaking spaces are not used in the URLs. I think we use URLs in two
different ways: named links, in which it is the first part between [ and a space
(no problem here, all underscores are unambiguously underscores) and in
automatically linked urls, as in which are also automatically

I do agree that this needs to be analyzed in detail to see where underscores are
currently used
Comment 6 Marcus Buck 2006-03-16 20:23:09 UTC
This really would be a useful feature.

Non-breaking space is nearly uninsertable for technical laymen (and unvisible in
source code, when directly inserted). The function should be context sensitive,
so when the underscore is between two numbers the   should become a
  (for separating numbers in three digit groups). I don't see any real
problems, because all appearances of underscores are in specific syntactical
contexts, where replacement could be disabled. Only accentuation through setting
in _underscores_ is not everytime obvious, but this never shows up in real text,
only in discussions. 
Comment 7 lɛʁi לערי ריינהארט 2006-04-27 12:34:56 UTC
(In reply to comment #6)
> This really would be a useful feature.

Agree. But remember there are a lot of wikilinks where underscores are used and
their meaning is "space". This happens if parts of the url get copied and pasted
by editors.

Please remember that [[_]] is *not* a valid title but [[ ]] *is*. See

This means that in order to be backward compatible "_" should be a substitute
for   outside [ ... ], [[ ... ]].
But what about full urls like ?
Comment 8 Marcus Buck 2006-05-03 15:17:04 UTC
Underscores in links are already now wrong (or at least not needed), so there should 
be no problem to eliminate them from the database per script. After that, they also 
could be used as non-breaking spaces in links (your extreme example could be sorted 
out on conversion, I think. But even when there are further problems, which I weren't 
aware, then a form [[The link|The_link]] should work, IMHO.)

Full URLs are no problem, too. If they are valid, they will normally render as 
external links without replacement, if they are invalid, as in your example, the 
underscore will be replaced with non-breaking space, this is just logical. You can't 
expect invalid URLs to render as if they were valid.
Comment 9 Michael Zajac 2006-08-01 23:10:00 UTC
On a Mac, just type alt-space to enter a literal Unicode non-breaking space.  Unfortunately, occasionally some editor's edit 
using some browsers convert these to plain spaces throughout an article.  The exceedingly-rare MSIE 5.0/Mac does this, and I 
think some rare version of MSIE/Windows, but I don't know which.
Comment 10 Aryeh Gregor (not reading bugmail, please e-mail directly) 2006-08-02 02:08:17 UTC
Actually, the situation is much worse than that.  All Gecko-based browsers do
it.  See bug 6790, and
(linked from there).
Comment 11 Denis Jacquerye 2006-08-03 21:26:21 UTC
(In reply to comment #2)
> There's already a unicode character for a non-breaking space, use that.

It doesn't work, mediawiki replaces it by a regular space. It's very, very, very
Comment 12 Denis Jacquerye 2006-08-03 21:33:41 UTC
ah... gecko replaces it. sorry for the spam.

(In reply to comment #6)
Isn't thinsp problematic since it's breakable?
Comment 13 Hendrik Lönngren 2007-11-02 15:35:27 UTC
In my opinion, typing alt+0160 on Windows is nearly as fast as typing an underscore. On Mac, it is even easier. So my suggestion is to replace all non-breaking spaces by “ ” on submission. This would
– prevent Firefox 2 users from eating all non-breaking spaces on editing
– make it possible for typographers to actually see which sort of space is used in the source.
Note that the Gecko behaviour has been changed for Gecko 1.9, so Firefox 3 won’t have that bug anymore. But so long, Firefox 2 users will have to keep typing “ ” until Firefox 3 is out.
Comment 14 Omegatron 2008-04-05 20:07:07 UTC
As an alternative, add the non-breaking spaces automatically on page render where they are required.  This is the more wiki-like functionality, where the software tries to output what you mean and you don't have to specify formatting by hand like HTML.  See Bug 13619
Comment 15 Purodha Blissenbach 2011-02-19 10:56:04 UTC
kshwiki uses "_" (underscore) as a character denoting that there certainly is no audible pause between two words as opposed to " " (space) which may represent an audible pause, or not. There are cases where not using "_" creates gross ambiguities. Otherwise, authors are usually lazy and don't use it.
Comment 16 Sebastian Werk 2013-01-02 17:55:00 UTC
For all the examples in the very first post, it would be better to use the thin space instead of the non-breaking spaces. In general there are only few cases, where you really need a non-breaking-space but a lot of cases, where you need the thin space.

An automation as proposed in comment 13 is extremely difficult, since the thin space is used for in lot of different cases for good typographie (copy the examples to some editor with non-mono-font):

Paragraphs: § 1
Units: 15 km, 100 %
Calculation: 3 + 2 = 5
Abbreviations in some languages: z. B. (German)

The forth example is hardly implementable for all languages, the second one even worse, just take the unit “a” (year). There might be cases, where it is better to use the unit in text, but how could be determined, if the unit is meant or the article?

Therefore I think a way to manually implement the thin space is required.

The use of the correct Unicode-Character is possible but could lead to copy-paste problems, since the thin space and non-breaking-space is not detectable in mono-font-editors. Furthermore it is difficult to write, if you don’t use a keyboard layout like NEO2.

I would propose the following, which was discussed in w:de some years ago
(discussion felt asleep back then):

Use of underscores for thin- and non-breaking-spaces within the wiki-code:

One underscore for thin-space: _ ⇒ “ ”
Two underscores for n-b-space: __ ⇒ “ ”

Numbers above 2100 could be automatically replaced with 2 500 in some languages like German (lower numbers could be years).

Underscores are hardly ever used, except for links (there a filter can easily
be implemented). In those rare remaining cases, the nowiki-tag can be used.

This would allow every user with minimal experience to use the correct typography, avoid long lists of common abbrevations as discussed in bug 13619 and ensure, that copy-paste-errors of spaces are easily detectable. As far as I know, all common browsers support both, the nbsp and the thin-space now.

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