1

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.

4
  • 1
    Try a Unicode string literal: L"...". Commented Nov 24, 2010 at 14:39
  • 1
    d'oh. thanks, it works. I was so hanged on to blaming the compiler, didn't even consider this. Commented Nov 24, 2010 at 14:45
  • @Philipp: Post your answer below. Commented Nov 25, 2010 at 19:49
  • @Ignacio Vazquez-Abrams: Done. (Usually I avoid posting answers that consist of single lines and that I haven't tested.) Commented Nov 25, 2010 at 22:18

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.