diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /external/libnumbertext/WinUnicodePath.patch1 | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'external/libnumbertext/WinUnicodePath.patch1')
-rw-r--r-- | external/libnumbertext/WinUnicodePath.patch1 | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/external/libnumbertext/WinUnicodePath.patch1 b/external/libnumbertext/WinUnicodePath.patch1 new file mode 100644 index 0000000000..24a0bd5800 --- /dev/null +++ b/external/libnumbertext/WinUnicodePath.patch1 @@ -0,0 +1,20 @@ +To allow opening files on Unicode paths on Windpws, expect passed 8-bit +strings to be UTF-8-encoded, and convert them to wchar_t. Fallback to +ACP strings for backward compatibility. + +diff --git a/src/Numbertext.cxx b/src/Numbertext.cxx +--- a/src/Numbertext.cxx ++++ b/src/Numbertext.cxx +@@ -27,7 +27,11 @@ + bool readfile(const std::string& filename, std::wstring& result) + { + #ifdef _WIN32 +- std::ifstream ifs(filename); ++ // First try to convert from UTF-8 ++ std::ifstream ifs(Numbertext::string2wstring(filename)); ++ // Fallback to ACP string for backward compatibility ++ if (ifs.fail()) ++ ifs.open(filename); + if (ifs.fail()) + return false; + std::stringstream ss; |