diff options
Diffstat (limited to 'svtools/source/svrtf/svparser.cxx')
-rw-r--r-- | svtools/source/svrtf/svparser.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index 0fec7a97097e..dd5068976ff7 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -247,7 +247,27 @@ sal_uInt32 SvParser<T>::GetNextChar() rInput.ReadUtf16(cUC); bErr = !rInput.good(); if( !bErr ) + { c = cUC; + if (rtl::isHighSurrogate(cUC)) + { + const sal_uInt64 nPos = rInput.Tell(); + rInput.ReadUtf16(cUC); + bErr = !rInput.good(); + if (!bErr) + { + if (rtl::isLowSurrogate(cUC)) + c = rtl::combineSurrogates(c, cUC); + else + rInput.Seek(nPos); // process lone high surrogate + } + else + { + bErr = false; // process lone high surrogate + rInput.Seek(nPos); // maybe step 1 byte back + } + } + } } else { |