KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How it is best of all to set the encoding in C++? I got used to working with Unicode (and wchar_t , wstring , wcin , wcout and L" ... "). I also save source in UTF-8. At the moment I use MinGW (Windows 7) and run my program in Windows console (cmd.exe), but sometimes I can use gcc on GNU\Linux and run promgram in Linux console with UTF-8 encoding. At all times I want to compile my source on Windows and on Linux and I want that all Unicode symbols were correctly inputed and outputed. When I faced the next problem with encodings, I googled. Also I found the most different councils: setlocale(LC_ALL, "") and setlocale(LC_ALL, "xx_XX.UTF-8") , std::setlocale(LC_ALL, "") and std::setlocale(LC_ALL, "xx_XX.UTF-8") from <clocale> , SetConsoleCP() and SetConsoleOutputCP() from <windows.h> and many, many others. At last I was bothered by this shamanism and I want to ask you: how it is correct to establish the encoding?
Tags (comma-separated)
Save Edits
Cancel