Mercurial > minori
diff src/core/strings.cpp @ 62:4c6dd5999b39
*: update
1. updated animia
2. use widestrings for filesystem on Windows
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 01 Oct 2023 06:16:06 -0400 |
parents | cde8f67a7c7d |
children | fe719c109dbc |
line wrap: on
line diff
--- a/src/core/strings.cpp Fri Sep 29 15:52:31 2023 -0400 +++ b/src/core/strings.cpp Sun Oct 01 06:16:06 2023 -0400 @@ -4,6 +4,7 @@ #include "core/strings.h" #include <algorithm> #include <cctype> +#include <codecvt> #include <locale> #include <string> #include <vector> @@ -75,4 +76,14 @@ return result; } +std::wstring ToWstring(const std::string& string) { + std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter; + return converter.from_bytes(string); +} + +std::string ToUtf8String(const std::wstring& wstring) { + std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter; + return converter.to_bytes(wstring); +} + } // namespace Strings