Strip invalid XML 1.0 control characters (0x00-0x08, 0x0B-0x0C, 0x0E-0x1F) from text to prevent corrupted docx files that fail to open in LibreOffice. Fixes SAXParseException 'PCData Invalid Char value' errors.
This commit is contained in:
1 parent
8b4f538cbb
commit
64c8679044
6 files changed
+108
-2
No files matched your search
@@ -8,7 +8,7 @@ module Notare
|
||||
def initialize(text, bold: false, italic: false, underline: false,
|
||||
strike: false, highlight: nil, color: nil, style: nil)
|
||||
super()
|
||||
@text = text
|
||||
@text = XmlSanitizer.sanitize(text)
|
||||
@bold = bold
|
||||
@italic = italic
|
||||
@underline = underline
|
||||
|
||||
Reference in new issue
Block a user