std::locale::global(std::locale("japanese"))でlocaleを日本語に設定できる。 #include <iostream> #include <locale> using namespace std; int main() { locale::global(locale("japanese")); wstring str1_jp = L"Hello!"; wstring str2_jp = L"こんにちは"; wcout << str1_jp << L": " << str1_jp.length() << endl; wcout << str2_jp << L": " << str2_jp.length() << endl; locale::global(locale("english")); wstring str1_en = L"Hello!"