The project is too big to show in full, but what I tried to do to narrow my search for problematic places is to display a test string at the beginning of my
main()
function. This way I can ensure that nothing that happens further down has any influence over
nowide::cin
and
nowide::cout
.
Pasting this code at the
very beginning of my
main()
function:
1 2 3 4 5 6 7
|
int main() {
std::string s;
nowide::cout << s;
std::string cs;
nowide::cin >> cs; nowide::cout << cs;
// ...
}
|
gives the same "squares & crosses" results - no matter whether English or Polish.
|The most interesting thing about the issue is that I had a
working test project where, before changing my "real" project, I was checking if everything works fine. Nowide on the test project worked fine before implementing nowide to the "real" project, however once the "real" project started to output garbage, so did the test project after I returned to it (sic!).
The test project
main()
code (nowide\iostream.cpp besides that):
1 2 3 4 5 6 7 8 9 10 11 12
|
#include "nowide\iostream.hpp"
#include "nowide\fstream.hpp"
int main() {
nowide::cout << "zażółć gęślą jaźń" << std::endl;
nowide::cout << "something different żżżż" << std::endl;
std::string str;
std::getline(nowide::cin, str);
nowide::cout << str;
nowide::cin.get();
return 0;
}
|
I anticipate questions about the code:
1. Source file is 65001 encoded with the use of
Advanced Save Options.
2. Project options are set to Unicode to avoid data loss.
3. nowide::iostream.cpp is included in the project.
4. The code, as I said,
worked ok before I implemented nowide to my "real" project which is suuuuper bizzare.
4,5 Both projects have different solutions on Visual Studio 2017, if there ever was a suspiction that they may share some wrong settings.
5. I
do use the standalone version of nowide.