Convert an UTF8 string to a wide Unicode String
| 952 | |
| 953 | // Convert an UTF8 string to a wide Unicode String |
| 954 | std::wstring IGFD::Utils::UTF8Decode(const std::string& str) { |
| 955 | std::wstring res; |
| 956 | #ifdef _IGFD_WIN_ |
| 957 | if (!str.empty()) { |
| 958 | int size_needed = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), nullptr, 0); |
| 959 | if (size_needed) { |
| 960 | res = std::wstring(size_needed, 0); |
| 961 | MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &res[0], size_needed); |
| 962 | } |
| 963 | } |
| 964 | #else |
| 965 | // Suppress warnings from the compiler. |
| 966 | (void)str; |
| 967 | #endif // _IGFD_WIN_ |
| 968 | return res; |
| 969 | } |
| 970 | |
| 971 | bool IGFD::Utils::ReplaceString(std::string& str, const ::std::string& oldStr, const ::std::string& newStr, const size_t& vMaxRecursion) { |
| 972 | if (!str.empty() && oldStr != newStr) { |