Unable to set window text using special Unicode char

I am trying to set the text of a dialog element by code with a special Unicode character as shown below:

https://www.fileformat.info/info/unicode/char/1f310/index.htm

I am trying to call the SetWindowTextW function, passing the value of UTF-16 (hex) as a parameter with no success:

GetDlgItem(IDSETTINGS)->SetWindowTextW(_T("\uD83C\uDF10"));

When I create my solution, I got two errors:

error C3850: '\ uD83C' a universal-character-.name indicates an invalid character

error C3850: '\ uDF10' a universal-character-.name indicates an invalid character

I will be grateful for any help.

+4
source share
1 answer

In this case, the cause of the C3850 compiler error can be found in the link (highlighted mine):

, , Unicode 0-10FFFF. Unicode, D800-DFFF, . .

UTF-32 :

GetDlgItem( IDSETTINGS )->SetWindowTextW( L"\U0001F310" );

, , Unicode, UTF-8 .

GetDlgItem( IDSETTINGS )->SetWindowTextW( L"🌐" );

, _T() _TEXT() API W (Unicode). , API , L .

+8

Source: https://habr.com/ru/post/1694514/


All Articles