summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-11-16 14:28:15 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-11-17 17:48:14 +0100
commit5ca52d169a3bee2082c3c087b7c3d53eae16d4d9 (patch)
tree334b9ef2cb0735d4905164f22fefe403a637dd19 /svtools/source
parent0763b640cc6f36946b5046bc1a262c902680dbd2 (diff)
ofz#40766 svtools, sw: HTMLParser: really stop inserting control chars
35d248cab1f0d4800f72abb5cb6afb56f40d9083 forgot to fix one place where control characters were in a presumed XML declaration. Another place looks missing where comments are handled, but it's not clear if these can be passed on to Writer. Revert the previous fix from commit b3325ef8cdfc2c82eec34e747106f75a9fccb7e4. Change-Id: I11ad13de9122533626e512ce0384051e3e5bd97f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125306 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit a7116b890ccd6dd1721413b4de6591a8057668ef)
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/svhtml/parhtml.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 67f5a87862ad..563ef0f76755 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -1058,6 +1058,7 @@ HtmlTokenId HTMLParser::GetNextToken_()
sTmpBuffer.appendUtf32( nNextCh );
nNextCh = GetNextChar();
} while( '>' != nNextCh && '/' != nNextCh && !rtl::isAsciiWhiteSpace( nNextCh ) &&
+ !linguistic::IsControlChar(nNextCh) &&
IsParserWorking() && !rInput.eof() );
if( !sTmpBuffer.isEmpty() )
@@ -1135,8 +1136,11 @@ HtmlTokenId HTMLParser::GetNextToken_()
if( !bDone )
sTmpBuffer.appendUtf32(nNextCh);
}
- else
+ else if (!linguistic::IsControlChar(nNextCh)
+ || nNextCh == '\r' || nNextCh == '\n' || nNextCh == '\t')
+ {
sTmpBuffer.appendUtf32(nNextCh);
+ }
if( !bDone )
nNextCh = GetNextChar();
}