| 68 | } |
| 69 | |
| 70 | std::string utf8ToSystem( const std::string & utf8 ) |
| 71 | { |
| 72 | #ifdef _WIN32 |
| 73 | auto utf16 = utf8ToWide( utf8.c_str() ); |
| 74 | auto rsize = WideCharToMultiByte( CP_ACP, 0, utf16.data(), ( int )utf16.size(), NULL, 0, NULL, NULL ); |
| 75 | std::string res( size_t ( rsize ), '\0' ); |
| 76 | BOOL usedDefaultChar = FALSE; |
| 77 | rsize = WideCharToMultiByte( CP_ACP, 0, utf16.data(), (int)utf16.size(), res.data(), int( res.size() ), NULL, &usedDefaultChar ); |
| 78 | if ( usedDefaultChar || rsize == 0 ) |
| 79 | { |
| 80 | spdlog::error( GetLastError() ); |
| 81 | return {}; |
| 82 | } |
| 83 | res.resize( rsize ); |
| 84 | return res; |
| 85 | #else |
| 86 | return utf8; |
| 87 | #endif |
| 88 | } |
| 89 | |
| 90 | std::string utf8substr( const char * s, size_t pos, size_t count ) |
| 91 | { |
nothing calls this directly
no test coverage detected