From 7fa7cb7f0b222864be7416c683166876eab190bc Mon Sep 17 00:00:00 2001 From: wandererfan Date: Wed, 29 Mar 2023 07:53:54 -0700 Subject: [PATCH] [Part]handle unicode filename on win --- src/Mod/Part/App/FT2FC.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Mod/Part/App/FT2FC.cpp b/src/Mod/Part/App/FT2FC.cpp index 97ae5a92c20d..24e8e739a69f 100644 --- a/src/Mod/Part/App/FT2FC.cpp +++ b/src/Mod/Part/App/FT2FC.cpp @@ -60,6 +60,7 @@ #endif // _PreComp #include +#include #include "TopoShapeWirePy.h" @@ -126,8 +127,14 @@ PyObject* FT2FC(const Py_UNICODE *PyUString, throw std::runtime_error(ErrorMsg.str()); } + std::ifstream fontfile; - fontfile.open(FontSpec, std::ios::binary|std::ios::in); +#ifdef FC_OS_WIN32 + Base::FileInfo winFI(FontSpec); + fontfile.open(winFI.toStdWString().c_str(), std::ios::binary | std::ios::in); +#else + fontfile.open(FontSpec, std::ios::binary | std::ios::in); +#endif if (!fontfile.is_open()) { //get indignant ErrorMsg << "Can not open font file: " << FontSpec;