I built a web app in Python and Flask that uses python-docx to parse Word documents, send the text content in JSON format to an AI to be proofread, and then sends the content back to be reassembled into a new (proofread) Word document. I've used the app to proofread over ten documents with no issues. However recently I ran into an error with one specific document. When I try to run it through the app I got this error message: "An error occurred: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters" I'm not sure why this is happening with this specific document. The document that is giving the issue was written in the latest version of Word, as far as I know. Has anyone else encountered this problem? Let me know if you need anything else. Here are several things I've tried already to no avail: Converted the document to .odt and then back to .docx Removed all footnotes Tried removing all non-XML characters with some python code Thankful for any help! Continue reading...