| 290 | #endif |
| 291 | |
| 292 | std::wstring Utf8ToUtf16(const std::string & str) |
| 293 | { |
| 294 | if (str.empty()) { |
| 295 | return std::wstring(); |
| 296 | } |
| 297 | |
| 298 | #ifdef _WIN32 |
| 299 | int sz = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0); |
| 300 | std::wstring wstr(sz, 0); |
| 301 | MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &wstr[0], sz); |
| 302 | return wstr; |
| 303 | #else |
| 304 | throw Exception("Only supported by the Windows platform."); |
| 305 | #endif |
| 306 | } |
| 307 | |
| 308 | std::string Utf16ToUtf8(const std::wstring & wstr) |
| 309 | { |