Category : wstring

std::vector<std::wstring> name_list; name_list.push_back(L"name1"); name_list.push_back(L"name2"); //— if (allname->name.find(name_list[0].data()) != std::wstring::npos) { //deosomething } I can use this but I want to find all entries in the vector to check if they exist [allname->name.find()] this code is necessary type force is wstring. How should I do? Source: Windows Que..

Read more

I’m converting wstring to string with std::codecvt_utf8 as described in this question, but when I tried Greek or Chinese alphabet symbols are corrupted, I can see it in the debug Locals window, for example 日本 became "日本" std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv; //also tried codecvt_utf8_utf16 std::string str = myconv.to_bytes(wstr); What am I doing wrong? Source: Windows Que..

Read more

I need to write a C++ that reads country names in Portuguese (Latin language with special characters like é and á) This is the code I am using: int main(int, const char *[]) { setlocale(LC_ALL, "en_US.UTF-8"); locale accents("en_US.UTF-8"); wcout.imbue(accents); wstring belgium, italy; belgium = L"bélgica"; italy = L"itália"; wcout << L"Result: " << setw(15) << ..

Read more