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

3 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?

3 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.

3 Likes

Can the mornalize_whitespaces be realized when a new setting (on by default) ask it? Then a local admin could opt-out of this feature when for their usage, the griefing is less a problem than typography ?

1 Like

Really fast google tour told that is not true. Or am I misunderstanding what spaced means? ← That questionmark is not spaced, AFAIK.

And that grammatical rule, as not dividing thousands, applies to every (western) languages. Like There Shouln’t Be Something Like This Either :wink:

I’d like to see which sources told you that french do “glue” together the word and the punctuation.

Here are some source telling that the punctuation (?, !, :, not . neither ,) should be space from the word on their left, like : « Comment vas-tu ? »

  • https://jacques-andre.fr/faqtypo/lessons.pdf page 32 it’s a free book about french typography
  • In the « Lexique des règles typographiques en usage à l’Imprimerie nationale » (Glossary of typographical rules used by the National Printing Office), page 149 we see: « espace fine insécable ? espace juistifiante » so they don’t tell to use a U+00A0 (NO-BREAK SPACE) but a U+202F (NARROW NO-BREAK SPACE) (that I don’t know how to type on my keyboard, but still it’s not a U+0020 (SPACE). (Sadly the book is not free so I don’t have a hyperlink to it).
  • French Wikipedia tells: « En France, il est d’usage de placer une espace fine insécable avant le point d’interrogation, ou une espace insécable si la fine n’est pas disponible. » (In France, it is customary to place a thin non-breaking space before the question mark, or a non-breaking space if the fine is not available.)
2 Likes

One study/workbook for beginners who think they can learn french :wink: I should go to back…, I don’t know what it is in english but something like community eveningschool for adults — a way to spend freetime and learn something new — and take a picture of that text.

But I stand correct. You know for sure this better than me ever,

1 Like