0
#include <iostream>
#include <clocale>
#include <string>
int main() {
std::setlocale(LC_ALL, "en_US.utf8");
std::wstring str(L"Τὴ γλῶσσα μοῦ ἔδωσαν");
std::wcout << str << std::endl;
std::wcerr << str << std::endl;
}
這在終端上不產生輸出。wcout和wcerr:如何讓它與unicode一起工作?
我怎樣才能讓它產生UTF-8輸出?我認爲應該是C++支持的東西。
我知道utfcpp庫,我正在使用,但問題是具體是否有stdlib方式來打印UTF8。
這是平臺相關的。你在跑什麼? –
OS X在這裏。我會在一分鐘內在Linux上試用這個 –
在Linux上完美地工作。增加了osx標籤。 –