In the future (VS 2010 already supports it), this will be possible in standard C++ (finally!):
#include <string> #include <locale> #include <codecvt> std::wstring_convert<std::codecvt_utf8<wchar_t>> converter; const std::wstring wide_string = L"This is a string"; const std::string utf8_string = converter.to_bytes(wide_string);