diff --git a/include/stdex/unicode.hpp b/include/stdex/unicode.hpp index de11755c1..9abdd7346 100644 --- a/include/stdex/unicode.hpp +++ b/include/stdex/unicode.hpp @@ -62,6 +62,11 @@ namespace stdex constexpr charset_id system_charset = charset_id::system; #endif + /// + /// Parses charset name and returns matching charset code + /// + /// Charset name + /// Charset code or `charset_id::system` if match not found inline charset_id charset_from_name(_In_z_ const char* name) { struct charset_less { @@ -109,6 +114,17 @@ namespace stdex return charset_id::system; } + /// + /// Parses charset name and returns matching charset code + /// + /// Charset name + /// Charset code or `charset_id::system` if match not found + template , class _Alloc = std::allocator> + inline charset_id charset_from_name(_In_ const std::basic_string& name) + { + return charset_from_name(name.c_str()); + } + /// /// Encoding converter context ///