Reputation: 12254
I'm trying to do something as simple as this:
#include <iostream>
#include <string>
using namespace std;
int main()
{
wstring nihongo = L"みんなのにほんご";
wcout << nihongo << endl;
return 0;
}
But I get the following errors:
C:\Users\Leonne\Leomedia\MetaDatterTest.cpp|7|error: stray '\201' in program|
C:\Users\Leonne\Leomedia\MetaDatterTest.cpp|7|error: stray '@' in program|
C:\Users\Leonne\Leomedia\MetaDatterTest.cpp||In function 'int main()':|
C:\Users\Leonne\Leomedia\MetaDatterTest.cpp|7|error: converting to execution character set: Illegal byte sequence|
||=== Build finished: 3 errors, 0 warnings ===|
I'm in a Windows machine and I am attempting to make a library that is as portable as possible, and it must be able to deal with any kind of characters: Russian, Japanese, ASCII, everything.
Upvotes: 4
Views: 9682
Reputation: 14148
Visual Studio support unicode source files. Make sure that your cpp files are saved a utf16 or utf8 formatted files with a BOM. Once in that format your files will compile fine.
Upvotes: 3
Reputation: 3844
Check the first answer on this question:
and my answer on this:
I believe you will find there an answer to your question. Troubles with character coding are a bit confusing stuff and there is no simple answer...
Upvotes: 1