You must use the codecvt_byname facet to use C locale conversions.
To do locale-specific conversions, the codecvt_byname facet must be installed in the locale:
typedef std::codecvt_byname<wchar_t, char, std::mbstate_t> ucs2utf; locale default_locale(std::locale(), new ucs2utf("en_US.utf8"));