No-break space and narrow no-break space are replaced by space

Would it be possible to allow no-break space (NBSP, U+00A0) and even narrow no-break space (NNBSP, U+202F) in the posts?

Currently they are replaced by normal space (SP, U+0020) by Discourse (even in code fragments), thus breaking French number display when text is wrapping.

In French, there should be an NNBSP at least, before punctuation like !?;:», after punctuation like «–—, and between groups of three digits in big numbers.

Here is an example of broken display per French standards:

image

2 400 000 and 28 800 should not be cut in their half like this, they should stay on the same line.

I think when a text includes NBSP or NNBSP, it is not a typo, not an unintentional mistake.

3 Likes

Are there HTML entities for these?   for example works like so:       ← spaces

2 Likes

Let’s try   for NARROW NO-BREAK SPACE thousands separator 80 000 test 80 000 test 80 000 test 80 000 test 80 000 80 000 test 80 000 test 80 000 80 000 test 80 000 test 80 000 test 80 000 test 80 000 test 80 000 test 80 000 test 80 000 80 000 test 80 000 test 80 000 test 80 000 test 80 000.

Then it works indeed!
I edited my post on the other forum and now the numbers are displayed good.
There is no named HTML entity but I can use the unicode code like this. :slight_smile::+1:
Thanks for the work-around, @codinghorror.

2 Likes

+1 on this, in french we do no-break space before our :, !, ? as they’re spaced from the previous word and we don’t want them to land on the next line.

Current behavior of replacing no-break-spaces by spaces:

By keeping the no-break-space there’s no longer the “alone semicolumn”:

I don’t think there’s a need for an html escape sequence for those characters, like there’s no need for an html escape sequence for any other non-ascii characters: pages are given to the browser encoded in UTF-8 and no-break-space, like all other characters does have an UTF-8 representation, for example:

→, √, ½, ñ, Ł, …

(In other word, why do Discourse allows for most unicode sequences but not no-break-spaces?)

4 Likes

Yes, I fully agree.
I can never remember the   syntax for NARROW NO-BREAK SPACE. :confused:

1 Like

What do you think @joffreyjaffeux and @zogstrip ?

And U+202F narrow no-break space too.
The most natural looking pre-punctuation character, as on French prints.

It’s our text cleaner:

I think this was done to avoid a form of trivial griefing where people make edits to posts and they change nothing and people scratch head to say … what has changed?

2 Likes

Yeah that’s what I remember as well. I would be fine removing this mornalize_whitespaces method provided we have a better way of doing/showing the diffs when such “characters” are used to grief.

1 Like