diff options
-rw-r--r-- | svtools/source/svhtml/parhtml.cxx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index a048ab92d923..6ce236566e61 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -30,6 +30,7 @@ #include <tools/datetime.hxx> #include <unotools/datetime.hxx> #include <svl/inettype.hxx> +#include <svl/lngmisc.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> @@ -454,8 +455,12 @@ HtmlTokenId HTMLParser::ScanText( const sal_Unicode cBreak ) else nNextCh = 0U; - if ( ! rtl::isUnicodeCodePoint( cChar ) ) + if (!rtl::isUnicodeCodePoint(cChar) + || (linguistic::IsControlChar(cChar) + && cChar != '\r' && cChar != '\n' && cChar != '\t')) + { cChar = '?'; + } } else if( rtl::isAsciiAlpha( nNextCh ) ) { @@ -751,8 +756,11 @@ HtmlTokenId HTMLParser::ScanText( const sal_Unicode cBreak ) else { do { + if (!linguistic::IsControlChar(nNextCh)) + { // All remaining characters make their way into the text. - sTmpBuffer.appendUtf32( nNextCh ); + sTmpBuffer.appendUtf32( nNextCh ); + } if( MAX_LEN == sTmpBuffer.getLength() ) { aToken += sTmpBuffer; @@ -987,8 +995,11 @@ HtmlTokenId HTMLParser::GetNextRawToken() } [[fallthrough]]; default: - // all remaining characters are appended to the buffer - sTmpBuffer.appendUtf32( nNextCh ); + if (!linguistic::IsControlChar(nNextCh) || nNextCh == '\t') + { + // all remaining characters are appended to the buffer + sTmpBuffer.appendUtf32( nNextCh ); + } break; } |