external/liborcus/UnpackedTarball_liborcus.mk |    1 
 external/liborcus/win_path_utf16.patch        |   33 ++++++++++++++++++++++++++
 sc/source/filter/orcus/orcusfiltersimpl.cxx   |   14 ++++-------
 3 files changed, 40 insertions(+), 8 deletions(-)

New commits:
commit 3d0e85d7f215bf3748664219c64ff54e1e4a0094
Author:     Kohei Yoshida <[email protected]>
AuthorDate: Sat Jul 12 12:12:40 2025 -0400
Commit:     Kohei Yoshida <[email protected]>
CommitDate: Sat Jul 12 19:48:34 2025 +0200

    Put Mike's original fix back
    
    Per conversation here: https://gerrit.libreoffice.org/c/core/+/187762
    and some offline communcation.
    
    Change-Id: If66b74299dd965d237f368c6c901057241226458
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187779
    Tested-by: Jenkins
    Reviewed-by: Kohei Yoshida <[email protected]>

diff --git a/external/liborcus/UnpackedTarball_liborcus.mk 
b/external/liborcus/UnpackedTarball_liborcus.mk
index 6c1b846f23a0..8bf355a1abed 100644
--- a/external/liborcus/UnpackedTarball_liborcus.mk
+++ b/external/liborcus/UnpackedTarball_liborcus.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
 ifeq ($(OS),WNT)
 $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
        external/liborcus/windows-constants-hack.patch \
+       external/liborcus/win_path_utf16.patch \
 ))
 endif
 
diff --git a/external/liborcus/win_path_utf16.patch 
b/external/liborcus/win_path_utf16.patch
new file mode 100644
index 000000000000..0a6781e728b3
--- /dev/null
+++ b/external/liborcus/win_path_utf16.patch
@@ -0,0 +1,33 @@
+diff --git a/src/parser/stream.cpp b/src/parser/stream.cpp
+index 00395f59ff25..8f385fb8965a 100644
+--- a/src/parser/stream.cpp
++++ b/src/parser/stream.cpp
+@@ -147,6 +147,14 @@ std::tuple<std::string_view, size_t, size_t> 
find_line_with_offset(std::string_v
+     return std::make_tuple(line, line_num, offset_on_line);
+ }
+ 
++#ifdef _WIN32
++std::wstring to_wstring(std::string_view s)
++{
++    std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> conversion;
++    return conversion.from_bytes(s.data(), s.data() + s.size());
++}
++#endif
++
+ } // anonymous namespace
+ 
+ struct file_content::impl
+@@ -162,8 +170,13 @@ struct file_content::impl
+     impl() : content_size(0), content(nullptr) {}
+ 
+     impl(std::string_view filepath) :
++#ifdef _WIN32
++        content_size(fs::file_size(to_wstring(filepath))),
++        mapped_file(to_wstring(filepath).c_str(), bip::read_only),
++#else
+         content_size(fs::file_size(std::string{filepath}.c_str())),
+         mapped_file(std::string{filepath}.c_str(), bip::read_only),
++#endif
+         mapped_region(mapped_file, bip::read_only, 0, content_size),
+         content(nullptr)
+     {
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx 
b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 8b8023545186..acb391f6e3a1 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -130,14 +130,12 @@ bool ScOrcusFiltersImpl::importODS_Styles(ScDocument& 
rDoc, OUString& aPath) con
 {
     try
     {
-        OUString aURL;
-        if (osl::FileBase::getFileURLFromSystemPath(aPath, aURL) != 
osl::FileBase::E_None)
-            return false;
-
-        SvFileStream aSrc(aURL, StreamMode::READ);
-        CopiedTempStream aTemp(aSrc);
-        orcus::file_content content(aTemp.getFileName());
-
+#if defined _WIN32
+        OString aPath8 = OUStringToOString(aPath, RTL_TEXTENCODING_UTF8);
+#else
+        OString aPath8 = OUStringToOString(aPath, osl_getThreadTextEncoding());
+#endif
+        orcus::file_content content(aPath8);
         ScOrcusFactory aFactory(rDoc);
         ScOrcusStyles aStyles(aFactory);
         orcus::import_ods::read_styles(content.str(), &aStyles);

Reply via email to