开发者

unicode string literals in C++/CLI

开发者 https://www.devze.com 2023-01-26 22:10 出处:网络
Lets say I have this fragment of code which returns a unicode CLR string with Cyrillic letters property String^ EIDErrorDescriptionSr {

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

精彩评论

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