summaryrefslogtreecommitdiffstats
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 19:19:35 +0100
commit08a56e3f06bfd10df358818a76ccb61c7c0fe31c (patch)
tree3129e3fc36dda878d3adb016803d88c7c04f079e
parentofz#40593 remove Objects from m_xResizeDrawObjects if deleted during parse (diff)
downloadcore-08a56e3f06bfd10df358818a76ccb61c7c0fe31c.tar.gz
core-08a56e3f06bfd10df358818a76ccb61c7c0fe31c.zip
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)
-rw-r--r--svtools/source/svhtml/parhtml.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index dad59b28a2ab..8e0e64ec9bf3 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -1069,6 +1069,7 @@ HtmlTokenId HTMLParser::GetNextToken_()
aToken += sTmpBuffer.makeStringAndClear();
nNextCh = GetNextChar();
} while( '>' != nNextCh && '/' != nNextCh && !rtl::isAsciiWhiteSpace( nNextCh ) &&
+ !linguistic::IsControlChar(nNextCh) &&
IsParserWorking() && !rInput.eof() );
if( !sTmpBuffer.isEmpty() )
@@ -1141,8 +1142,11 @@ HtmlTokenId HTMLParser::GetNextToken_()
if( !bDone )
aToken += OUString(&nNextCh,1);
}
- else
- aToken += OUString(&nNextCh,1);
+ else if (!linguistic::IsControlChar(nNextCh)
+ || nNextCh == '\r' || nNextCh == '\n' || nNextCh == '\t')
+ {
+ aToken += OUString(&nNextCh, 1);
+ }
if( !bDone )
nNextCh = GetNextChar();
}