Why would you replace anything?
string
and wstring
are the string classes corresponding to char
and wchar_t
, which in the context of interfacing with the environment are meant to carry data encoded in, respectively, "the system's narrow-multibyte representation" and fixed-width in "the system's encoding".
On the other hand, u8
/u
/U
, as well as char16_t
and char32_t
, as well as the corresponding string classes, are intended for the storage of Unicode codepoint sequences encoded in UTF-8/16/32.
The latter is a separate problem domain from the former. The standard doesn't contain a mechanism to bridge the two domains (and a library such as iconv()
is typically required to make this bridge portable, e.g. by transcoding WCHAR_T/UTF-32).
Here's my standard list of related questions: #1, #2, #3