| 558 | |
| 559 | |
| 560 | std::wstring UTF8toUTF16(const std::string& s) { |
| 561 | if (s.empty()) |
| 562 | return L""; |
| 563 | // Compute length of output buffer |
| 564 | int len = MultiByteToWideChar(CP_UTF8, 0, &s[0], s.size(), NULL, 0); |
| 565 | assert(len > 0); |
| 566 | std::wstring w; |
| 567 | // Allocate enough space for null character |
| 568 | w.resize(len); |
| 569 | len = MultiByteToWideChar(CP_UTF8, 0, &s[0], s.size(), &w[0], len); |
| 570 | assert(len > 0); |
| 571 | return w; |
| 572 | } |
| 573 | #endif |
| 574 | |
| 575 |
no test coverage detected