| 1206 | } |
| 1207 | |
| 1208 | std::wstring WideString(const char* cin) |
| 1209 | { |
| 1210 | std::wstring buildbuffer; |
| 1211 | if (cin) |
| 1212 | { |
| 1213 | // This is a bit tricky because we need to support both UTF-8 and legacy content in ISO-8859-1 / Windows 1252 |
| 1214 | // and thanks to user-side string manipulation it can be that a text mixes both. |
| 1215 | // To convert the string this uses the same function as all text printing in the engine. |
| 1216 | const uint8_t* in = (const uint8_t*)cin; |
| 1217 | while (*in) buildbuffer.push_back((wchar_t)GetCharFromString(in)); |
| 1218 | } |
| 1219 | return buildbuffer; |
| 1220 | } |
| 1221 | |