开发者

unicode string literals in C++/CLI

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 开发者_Python百科can't seem to find one.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜