Skip to main content

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 replace filter:

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.


Thanks for reading



Craft CMS Support Plans

Our support plans are ideal for Craft CMS sites that need regular updates, improvements, and someone technical keeping an eye on things.

12 years Craft experience Regular Craft and plugin updates Custom plugin development Cloud hosting Backups and 24/7 monitoring Performance audits Technical SEO Pre-booked dev time Troubleshooting

We should talk

Tell us about what you’ve got, what’s not working, and where you want to get to.

Make Contact No recruitment agencies please.