Redactor 2 Bugfix
By Ian Ebden ·
Anyone that knows me knows that I’m currently completely in love with Craft CMS. My clients are too. It has all the flexibility that I need, and a smooth UX. Lately however, some clients have complained about odd formatting from ‘Rich Text’ fields brought about by the insertion of random non-breaking spaces. To be clear this isn’t a Craft bug, but a bug of the Redactor 2 WYSIWYG plugin used for Rich Text fields in Craft and many other CMS’s.
A fix is on the way, but in the meantime here’s a workaround I use in my templates using Twig’s
This will replace any offending non-breaking spaces with regular spaces, preserving normal formatting/rendering and semantics. It’s safe enough to leave in your templates, post any Redactor 2 fixes; and probably a good idea to use anyway in most instances because oftentimes content managers paste in content from programs like MS Word, which are guilty of sneaking in odd hidden characters.