[Libreoffice-commits] core.git: vcl/source

Stephan Bergmann sbergman at redhat.com
Tue Sep 26 08:49:23 UTC 2017


 vcl/source/filter/wmf/wmfwr.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 4bd1449aa036b88629f22e9516f7f67f6414fbfb
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Sep 26 10:45:28 2017 +0200

    Don't pessimize to RTL_TEXTENCODING_DONTKNOW
    
    ...when aTextEncodingOrg can't represent all chars, but getBestMSEncodingByChar
    doesn't know any better encoding, either.  (This happened during
    CppunitTest_sw_rtfexport, where it caused OUStringToOString to be called with
    RTL_TEXTENCODING_DONTKNOW from WMFWriter::WMFRecord_Escape_Unicode.)
    
    Change-Id: Ia975a2907f519172e7da4a370d97e1f4317b78b3

diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 51c7a6807bb5..2e35ebd26ea4 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -469,12 +469,18 @@ bool WMFWriter::WMFRecord_Escape_Unicode( const Point& rPoint, const OUString& r
                 pBuf = rUniStr.getStr();
                 const sal_Unicode* pCheckChar = pBuf;
                 rtl_TextEncoding aTextEncoding = getBestMSEncodingByChar(*pCheckChar); // try the first character
+                if (aTextEncoding == RTL_TEXTENCODING_DONTKNOW) {
+                    aTextEncoding = aTextEncodingOrg;
+                }
                 for ( i = 1; i < nStringLen; i++)
                 {
                     if (aTextEncoding != aTextEncodingOrg) // found something
                         break;
                     pCheckChar++;
                     aTextEncoding = getBestMSEncodingByChar(*pCheckChar); // try the next character
+                    if (aTextEncoding == RTL_TEXTENCODING_DONTKNOW) {
+                        aTextEncoding = aTextEncodingOrg;
+                    }
                 }
 
                 aByteStr = OUStringToOString(rUniStr,  aTextEncoding);


More information about the Libreoffice-commits mailing list