diff --git a/onnxruntime/core/common/threadpool.cc b/onnxruntime/core/common/threadpool.cc index 64cc921bc0..6354a4b80b 100644 --- a/onnxruntime/core/common/threadpool.cc +++ b/onnxruntime/core/common/threadpool.cc @@ -46,9 +46,11 @@ ThreadPoolProfiler::ThreadPoolProfiler(int num_threads, const CHAR_TYPE* thread_ child_thread_stats_.assign(num_threads, {}); if (thread_pool_name) { #ifdef _WIN32 - using convert_type = std::codecvt_utf8; - std::wstring_convert converter; - thread_pool_name_ = converter.to_bytes(thread_pool_name); + std::wstring ws(thread_pool_name); + thread_pool_name_.resize(ws.length()); + std::transform(ws.begin(), ws.end(), thread_pool_name_.begin(), [] (wchar_t c) { + return (char)c; + }); #else thread_pool_name_ = thread_pool_name; #endif