Question

Lets say I have this fragment of code which returns a unicode CLR string with Cyrillic letters

    property String^ EIDErrorDescriptionSr { 
       String^ get() 
       {
        switch(EIDErrorCode) 
        {
         case EID_OK: return "Операција успешно завршена";
...

When I read the property in C# code referencing this assembly, I get a bunch of the "?" as if the C++ compiler "flattened" the string to single-byte chars.

I did save the C++ source file as UTF-8 (even Unicode) and I always get this warning from the compiler for every non-ansi character:

warning C4566: character represented by universal-character-name '\u041E' cannot be represented in the current code page (1252)

Now, is there a compiler switch to force compiler to treat literals as unicode? I can't seem to find one.

Was it helpful?

Solution

Try a Unicode string literal: L"...".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top