3#ifndef _LOGIT_ENCODING_UTILS_HPP_INCLUDED 
    4#define _LOGIT_ENCODING_UTILS_HPP_INCLUDED 
   15#include <stringapiset.h> 
   22    inline std::string utf8_to_ansi(
const std::string& utf8) {
 
   23        int n_len = MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, NULL, 0);
 
   24        if (n_len == 0) 
return {};
 
   26        std::wstring wide_string(n_len + 1, L
'\0');
 
   27        MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, &wide_string[0], n_len);
 
   29        n_len = WideCharToMultiByte(CP_ACP, 0, wide_string.c_str(), -1, NULL, 0, NULL, NULL);
 
   30        if (n_len == 0) 
return {};
 
   32        std::string ansi_string(n_len - 1, 
'\0');
 
   33        WideCharToMultiByte(CP_ACP, 0, wide_string.c_str(), -1, &ansi_string[0], n_len, NULL, NULL);
 
   40    inline std::wstring utf8_to_wstring(
const std::string& utf8) {
 
   41        int n_len = MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, NULL, 0);
 
   42        if (n_len == 0) 
return {};
 
   43        std::wstring wide_string(n_len - 1, L
'\0');
 
   44        MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, &wide_string[0], n_len);
 
   51    inline std::string wstring_to_utf8(
const std::wstring& wide) {
 
   52        int n_len = WideCharToMultiByte(CP_UTF8, 0, wide.c_str(), -1, NULL, 0, NULL, NULL);
 
   53        if (n_len == 0) 
return {};
 
   54        std::string utf8(n_len - 1, 
'\0');
 
   55        WideCharToMultiByte(CP_UTF8, 0, wide.c_str(), -1, &utf8[0], n_len, NULL, NULL);
 
The primary namespace for the LogIt++ library.