I am aiming to create an std::vector<std::string>
with Farsi names. But as soon as I compile this I get this error:
This seems to be a unicode issue. Any suggestions how to fix this?
I am aiming to create an std::vector<std::string>
with Farsi names. But as soon as I compile this I get this error:
This seems to be a unicode issue. Any suggestions how to fix this?
Microsoft's Visual C++ compiler does support Unicode source code files. Specifically it accepts UTF-8 (byte order mark required) or UTF-16:
Source code files
Unicode characters are now supported in identifiers, macros, string and character literals, and in comments. Universal character names are also now supported.
Unicode can be input into a source code file in the following encodings:
UTF-16 little endian with or without byte order mark (BOM)
UTF-16 big endian with or without BOM
UTF-8 with BOM
Note in particular that for UTF-8, the byte order mark is required. The dialog in your screen shot is the Visual Studio editor detecting that you have entered non-ASCII characters and asking you if you want to convert the source code file to UTF-8 or UTF-16 (not sure what the default is but I'd guess UTF-8). If you click Yes, it will save the file with a UTF-8 byte order mark (BOM) and all should be well.