Post Reply 
Embedded code blocks and Firefox non-breaking spaces
11-26-2022, 10:52 AM (This post was last modified: 11-26-2022 11:01 AM by Thomas Klemm.)
Post: #5
RE: Embedded code blocks and Firefox non-breaking spaces
(11-26-2022 01:46 AM)DavidM Wrote:  If you copy the text in a code block by selecting it and performing "copy", the spaces in the source seem to be getting converted to non-breaking spaces when you paste it into an application.

The non-breaking space characters are already in the HTML-sources.
I used 10 space characters of each kind between two | characters both in a code-block and with a monospaced font:

Code:
SPACE: U+0020
|          |

NO-BREAK SPACE: U+00A0
|          |

EN SPACE: U+2002
|          |

em SPACE: U+2003
|          |

font-family: Courier

SPACE: U+0020
| |

NO-BREAK SPACE: U+00A0
| |

EN SPACE: U+2002
|          |

EM SPACE: U+2003
|          |

To me it boils down to:
  • only in code blocks SPACE and NO-BREAK SPACE are replaced by  
  • in ordinary text they are left as is
  • EN SPACE and EM SPACE are always left as is
Browsers squash multiple SPACE or NO-BREAK SPACE characters to a single one.
Thus these characters can not be used to format code in ordinary text.
However both EN SPACE and EM SPACE can be used.
But their length is the same as an ordinary SPACE.
At least in a monospaced font like Courier.

I recommend to view the page sources of this post.

(11-26-2022 09:07 AM)Didier Lachieze Wrote:  Does this happens also when copying from the Printable Version of the page?
Yes.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Embedded code blocks and Firefox non-breaking spaces - Thomas Klemm - 11-26-2022 10:52 AM



User(s) browsing this thread: 1 Guest(s)