summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/filter/excel/excel.cxx6
-rw-r--r--sc/source/filter/excel/impop.cxx6
-rw-r--r--sc/source/filter/excel/xistyle.cxx4
-rw-r--r--unotools/source/misc/defaultencoding.cxx6
4 files changed, 12 insertions, 10 deletions
diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index ca87efc2988c..386342988060 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -26,6 +26,8 @@
#include <tools/globname.hxx>
#include <com/sun/star/ucb/ContentCreationException.hpp>
#include <unotools/streamwrap.hxx>
+#include <unotools/defaultencoding.hxx>
+#include <unotools/wincodepage.hxx>
#include <osl/diagnose.h>
#include <filter.hxx>
#include <document.hxx>
@@ -118,7 +120,9 @@ ErrCode ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument*
{
pBookStrm->SetBufferSize( 0x8000 ); // still needed?
- XclImpRootData aImpData( eBiff, rMedium, xRootStrg, *pDocument, RTL_TEXTENCODING_MS_1252 );
+ XclImpRootData aImpData(
+ eBiff, rMedium, xRootStrg, *pDocument,
+ utl_getWinTextEncodingFromLangStr(utl_getLocaleForGlobalDefaultEncoding()));
std::unique_ptr< ImportExcel > xFilter;
switch( eBiff )
{
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index f130a39fccdd..5151232e108d 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -908,13 +908,7 @@ void ImportExcel::Rstring()
{
// unformatted Unicode string with separate formatting information
XclImpString aString;
-
- // #i63105# use text encoding from FONT record
- rtl_TextEncoding eOldTextEnc = GetTextEncoding();
- if( const XclImpFont* pFont = GetXFBuffer().GetFont( nXFIdx ) )
- SetTextEncoding( pFont->GetFontEncoding() );
aString.Read( maStrm );
- SetTextEncoding( eOldTextEnc );
// character formatting runs
if( !aString.IsRich() )
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 886f20dc5551..798dd8359ced 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -445,7 +445,7 @@ void XclImpFont::ReadFontData5( XclImpStream& rStrm )
maData.mbStrikeout = ::get_flag( nFlags, EXC_FONTATTR_STRIKEOUT );
maData.mbOutline = ::get_flag( nFlags, EXC_FONTATTR_OUTLINE );
maData.mbShadow = ::get_flag( nFlags, EXC_FONTATTR_SHADOW );
- mbHasCharSet = true;
+ mbHasCharSet = maData.mnCharSet != 0;
}
void XclImpFont::ReadFontColor( XclImpStream& rStrm )
@@ -578,8 +578,6 @@ void XclImpFontBuffer::ReadFont( XclImpStream& rStrm )
if( maFontList.size() == 1 )
{
UpdateAppFont( rFont.GetFontData(), rFont.HasCharSet() );
- // #i71033# set text encoding from application font, if CODEPAGE is missing
- SetAppFontEncoding( rFont.GetFontEncoding() );
}
}
diff --git a/unotools/source/misc/defaultencoding.cxx b/unotools/source/misc/defaultencoding.cxx
index b0e473d099bd..552f3b8c40d7 100644
--- a/unotools/source/misc/defaultencoding.cxx
+++ b/unotools/source/misc/defaultencoding.cxx
@@ -13,14 +13,20 @@
#include <unotools/defaultencoding.hxx>
#include <officecfg/Office/Linguistic.hxx>
#include <officecfg/Setup.hxx>
+#include <officecfg/System.hxx>
OUString utl_getLocaleForGlobalDefaultEncoding()
{
if (utl::ConfigManager::IsFuzzing())
return "en-US";
+ // First try document default language
OUString result(officecfg::Office::Linguistic::General::DefaultLocale::get());
+ // Fallback to LO locale
if (result.isEmpty())
result = officecfg::Setup::L10N::ooSetupSystemLocale::get();
+ // Fallback to system locale
+ if (result.isEmpty())
+ result = officecfg::System::L10N::Locale::get();
return result;
}