From 267c6f2ac71f92999e969232431ba04678e7437e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:54:39 +0200 Subject: Adding upstream version 4:24.2.0. Signed-off-by: Daniel Baumann --- external/libnumbertext/WinUnicodePath.patch1 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 external/libnumbertext/WinUnicodePath.patch1 (limited to 'external/libnumbertext/WinUnicodePath.patch1') 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; -- cgit v1.2.3