不间断空格和窄不间断空格被替换为空格

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 个赞

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

3 个赞

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 个赞

+1 on this, in French, we use a non-breaking space before our :, !, ? as they are spaced from the previous word and we don’t want them to land on the next line.

Current behavior of replacing non-breaking spaces with spaces:

Screenshot 2021-11-04 at 11-18-55 Jolie admin Flask - Entraide - AFPy

By keeping the non-breaking space, there is no longer the “lone semicolon”:

Screenshot 2021-11-04 at 11-19-43 Jolie admin Flask - Entraide - AFPy

I don’t think there’s a need for an HTML escape sequence for those characters, just 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 non-breaking spaces, like all other characters, have a UTF-8 representation, for example:

→, √, ½, ñ, Ł, …

(In other words, why does Discourse allow most Unicode sequences but not non-breaking spaces?)

4 个赞

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

1 个赞

@j.jaffeux@zogstrip,你们怎么看?

还有 U+202F 窄不间断空格
如法语印刷品般最自然的标点符号前字符。

这是我们的文本清理器:

我认为这样做是为了避免一种微不足道的垃圾信息形式,即人们编辑帖子但什么都没改变,然后大家挠头说……有什么变化吗?

3 个赞

是的,我也记得是这样。如果有一种更好的方法来处理/显示使用此类“字符”进行破坏时的差异,我很乐意删除这个 mornalize_whitespaces 方法。

3 个赞

当一个新的设置(默认启用)要求时,是否可以实现 mornalize_whitespaces?然后,本地管理员可以在其使用中选择退出此功能,因为与字体排印相比,他们的使用中捣乱问题较小?

1 个赞

快速谷歌搜索表明并非如此。或者是我误解了“有空格”的意思? ← 据我所知,这个问号没有空格。

而且,这种不分割千位数的语法规则适用于所有(西方)语言。就像这里也不应该出现这种情况一样 :wink:

我想看看是哪些来源告诉你法国人在单词和标点符号之间“粘”在一起。

这里有一些来源表明标点符号(?、!、:,而不是 . 或 ,)应该与它们左边的单词分开,例如:“Comment vas-tu ? »

  • https://jacques-andre.fr/faqtypo/lessons.pdf 第 32 页,这是一本关于法语排版的免费书籍
  • 在《Lexique des règles typographiques en usage à l’Imprimerie nationale》(法国国家印刷局使用的排版规则词汇表)第 149 页,我们看到:“espace fine insécable ? espace juistifiante”,所以他们没有说使用 U+00A0(不间断空格),而是使用 U+202F(窄不间断空格)(我不知道如何在键盘上输入它,但它仍然不是 U+0020(空格))。(可悲的是,这本书不是免费的,所以我没有它的超链接)。
  • 法语维基百科 提到:“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。”(在法国,习惯上在问号前放置一个窄不间断空格,或者在没有窄不间断空格的情况下放置一个不间断空格。)
2 个赞

一本供初学者学习法语的教材/练习册,他们认为自己可以学会法语 :wink: 我应该回去……, 我不知道英语里怎么说,但有点像成人的社区晚校——一种消磨闲暇时光、学习新东西的方式——然后拍下那段文字的照片。

但我承认我错了。你肯定比我更了解这个。

1 个赞