non-breaking spaces are being rewritten to spaces
See original GitHub issueWhen using collapseWhitespace:true
and conservativeCollapse:true
options, I’m seeing that non-breaking spaces (character code 160
, represented as \u00A0
below) are being incorrectly converted to regular spaces (character code 32
). This isn’t expected and can alter the presentation of the html - especially when the html is sent in an email. Some email clients such as gmail will collapse paragraphs with regular spaces.
$ node
> require('html-minifier').minify('<p>\u00A0</p>').charCodeAt(3)
160 // This is correct - a non-breaking space.
> require('html-minifier').minify('<p>\u00A0</p>',{collapseWhitespace:true, conservativeCollapse: true}).charCodeAt(3)
32 // This should be 160, a non-breaking space. Instead it's a regular space.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
Preventing the Insertion of Non-Breaking Spaces
If you want to get rid of non-breaking spaces already in the document, then using Find and Replace is the easiest way: Press...
Read more >How to Insert Nonbreaking Spaces in Microsoft Word
1. Place your cursor where the nonbreaking space should be inserted. · 2. Select the Insert tab. · 3. Select Symbols in the...
Read more >Topic: Non-breaking spaces appearing as extra-wide spaces
I've written before about a challenge I'm experiencing where non-breaking spaces are being inserted (rather than regular spaces) in my posts ...
Read more >Non-breaking space - Wikipedia
In word processing and digital typesetting, a non-breaking space, , also called NBSP, required space, hard space, or fixed space is a space...
Read more >Non breaking space - Microsoft Community
I want to prevent the automatic insertion of non-breaking spaces. I'm happy to use them when I want them but not when Word...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
3.3.2 fixes it. Nice one, thanks.
Thanks for the report - fixing via #780.