문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top