| 35 | } |
| 36 | |
| 37 | inline string WideCharToUtf8(const std::wstring& wstr) { |
| 38 | if (wstr.empty()) return std::string(); |
| 39 | int size_required = WideCharToMultiByte( |
| 40 | CP_UTF8, 0, wstr.c_str(), (int)wstr.size(), NULL, 0, NULL, NULL); |
| 41 | string utf8_translated_str(size_required, 0); |
| 42 | WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), (int)wstr.size(), |
| 43 | &utf8_translated_str[0], size_required, NULL, NULL); |
| 44 | return utf8_translated_str; |
| 45 | } |
| 46 | |
| 47 | } // namespace tensorflow |
| 48 |
no test coverage detected