I have a CKEditor Textarea in a page template. Some users like to add text in them by pasting from Word document. This leads to internal server error when saving page. When using paste without formatting (cmd + shift + V), page is saved normally, so I assume error has something to do with Word's hidden characters that cause issues in many other programs as well. (I don't have Word myself, so I debugged this with video chat with user. I forgot to ask to check code view, so I'm not sure if they are visible there.)
Is there a way in ProcessWire/PHP to sanitize Textarea input from these hidden characters, or can I prevent this by changing editor settings (listed below, if it helps)? I don't like leaving error handling rely to user action - somebody always forgets to do things specific way and it weakens user experience.
Textarea
formatting: none (htmlspecialchars off)
field type: CKEditor
content type: markup/html
experimental markup/html settings: all on
acf: on
html purifier: on
additional purify settings: all on
extra allowed content: none
add-ons: pwimage, pwlink, sourcedialog
sourcedialog settings: none
disabled add-ons: image, magicline