我有C++代碼轉換string包含(ALCHEMICAL SYMBOL FOR AQUA REGIA)至u16string: #include <string>
#include <codecvt>
#include <locale>
using namespace std;
int main() {
setlocale(LC_ALL, "ru_RU.UTF-8");
以下是使用std::codecvt_utf8<>方面從wchar_t轉換爲UTF-8的代碼片段。使用Visual Studio 2012,我的期望不符合(請參閱代碼末尾的條件)。我的期望錯了嗎?爲什麼?或者這是一個Visual Studio 2012庫問題? #include <locale>
#include <codecvt>
#include <cstdlib>
int main()
我有一個簡單的代碼,可以很好地處理輸入選項只包含ASCII字符,但會拋出一個錯誤消息爲「error:character conversion failed」 。有解決方案嗎? 背景信息: 1. Compiler and OS: VC++2012 running on Windows 8.1 64 bit
2. "_UNICODE" option is ON It works with