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

Stephan Bergmann sbergman at redhat.com
Tue Sep 26 18:29:20 UTC 2017


 sc/source/filter/excel/xestream.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 043bf2295a073ccc41459ef8cd1e134ba15d3718
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Sep 26 11:25:06 2017 +0200

    Don't use RTL_TEXTENCODING_DONTKNOW in OUStringToOString
    
    CppunitTest_sc_subsequent_export_test would run into that as below, so better
    find a more suitable encoding here (similar to what RTFDocumentImpl::getEncoding
    in writerfilter/source/rtftok/rtfdocumentimpl.cxx does to "Guess based on
    locale").
    
    > rtl::OUStringToOString(rtl::OUString const&, unsigned short, unsigned int) at include/rtl/ustring.hxx:3662
    > XclExpHyperlink::XclExpHyperlink(XclExpRoot const&, SvxURLField const&, ScAddress const&) at sc/source/filter/excel/xecontent.cxx:370
    > XclExpHyperlinkHelper::ProcessUrlField(SvxURLField const&) at sc/source/filter/excel/xehelper.cxx:307
    > (anonymous namespace)::lclCreateFormattedString(XclExpRoot const&, EditEngine&, XclExpHyperlinkHelper*, unsigned short, unsigned short) at sc/source/filter/excel/xehelper.cxx:471
    > XclExpStringHelper::CreateCellString(XclExpRoot const&, EditTextObject const&, ScPatternAttr const*, XclExpHyperlinkHelper&, unsigned short, unsigned short) at sc/source/filter/excel/xehelper.cxx:583
    > XclExpLabelCell::XclExpLabelCell(XclExpRoot const&, XclAddress const&, ScPatternAttr const*, unsigned int, EditTextObject const*, XclExpHyperlinkHelper&) at sc/source/filter/excel/xetable.cxx:708
    > XclExpCellTable::XclExpCellTable(XclExpRoot const&) at sc/source/filter/excel/xetable.cxx:2569
    > ExcTable::FillAsTableXml() at sc/source/filter/excel/excdoc.cxx:589
    > ExcDocument::ReadDoc() at sc/source/filter/excel/excdoc.cxx:771
    > XclExpXmlStream::exportDocument() at sc/source/filter/excel/xestream.cxx:1113
    > oox::core::FilterBase::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at oox/source/core/filterbase.cxx:495
    > oox::xls::ExcelFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sc/source/filter/oox/excelfilter.cxx:169
    > SfxObjectShell::ExportTo(SfxMedium&) at sfx2/source/doc/objstor.cxx:2380
    > SfxObjectShell::SaveTo_Impl(SfxMedium&, SfxItemSet const*) at sfx2/source/doc/objstor.cxx:1500
    > SfxObjectShell::DoSaveAs(SfxMedium&) at sfx2/source/doc/objstor.cxx:1889
    > ScBootstrapFixture::saveAndReload(ScDocShell*, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags) at sc/qa/unit/helper/qahelper.cxx:669
    > ScBootstrapFixture::saveAndReload(ScDocShell*, int) at sc/qa/unit/helper/qahelper.cxx:691
    > ScExportTest::testTdf111876() at sc/qa/unit/subsequent_export-test.cxx:438
    [...]
    
    Change-Id: Ia8a07336bc6fc39573676c227a551fbfe50a519e
    Reviewed-on: https://gerrit.libreoffice.org/42789
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index c4259dff9c4b..c1e0688731c0 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <utility>
 
+#include <filter/msfilter/util.hxx>
 #include <rtl/ustring.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/random.h>
@@ -1053,7 +1054,10 @@ bool XclExpXmlStream::exportDocument()
     tools::SvRef<SotStorage> rStorage = static_cast<SotStorage*>(nullptr);
     XclExpObjList::ResetCounters();
 
-    XclExpRootData aData( EXC_BIFF8, *pShell->GetMedium (), rStorage, rDoc, RTL_TEXTENCODING_DONTKNOW );
+    XclExpRootData aData(
+        EXC_BIFF8, *pShell->GetMedium (), rStorage, rDoc,
+        msfilter::util::getBestTextEncodingFromLocale(
+            Application::GetSettings().GetLanguageTag().getLocale()));
     aData.meOutput = EXC_OUTPUT_XML_2007;
     aData.maXclMaxPos.Set( EXC_MAXCOL_XML_2007, EXC_MAXROW_XML_2007, EXC_MAXTAB_XML_2007 );
     aData.maMaxPos.SetCol( ::std::min( aData.maScMaxPos.Col(), aData.maXclMaxPos.Col() ) );


More information about the Libreoffice-commits mailing list