diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-09-26 10:45:28 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-09-26 10:45:28 +0200 |
commit | 4bd1449aa036b88629f22e9516f7f67f6414fbfb (patch) | |
tree | f8a8ddd50dacab34d3b868697b70f29cd95fb88b /vcl/source/filter | |
parent | 01dea3321c23c7a83134f25a1ea62a6d3e8cddf4 (diff) |
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
Diffstat (limited to 'vcl/source/filter')
-rw-r--r-- | vcl/source/filter/wmf/wmfwr.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
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); |