1

Topic: How to receive the Chinese language in MessageBox

There is a function which returns in UTF-8 the Chinese phrase.

const char* txt;
txt = china_message ();
MessageBox (0, txt, "", 0);

On an output instead of hieroglyphs here it

2

Re: How to receive the Chinese language in MessageBox

1) to Transform UTF-8 in UTF-16.
2) to Use result of item 1 at function invocation MessageBoxW ().

3

Re: How to receive the Chinese language in MessageBox

Dimitry Sibiryakov wrote:

1) to Transform UTF-8 in UTF-16.
2) to Use result of item 1 at function invocation MessageBoxW ().

Does not work:

const char* txt;
txt = china_message ();
std:: string str = txt;
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
std:: wstring wstr = converter.from_bytes (str);
LPCWSTR u16 = wstr.c_str ();
MessageBoxW (0, u16, u16, 0);

4

Re: How to receive the Chinese language in MessageBox

Eolt;
If the brain does not work, I suggest to be trained on what easier. For example on cats in Russian in UTF8.
Earlier always there was a two-step translation of codings XXX-> bytes-> XXY, and at you one step.

5

Re: How to receive the Chinese language in MessageBox

Eolt wrote:

does not work:

You do not know how to cook converters - use old kind MutliByteToWideChar ().

6

Re: How to receive the Chinese language in MessageBox

Eolt wrote:

it is passed...
Does not work:

const char* txt;
txt = china_message ();
std:: string str = txt;
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
std:: wstring wstr = converter.from_bytes (str);
LPCWSTR u16 = wstr.c_str ();
MessageBoxW (0, u16, u16, 0);

Pancake the error appeared in china_message! Dimitry Sibiryakov it was right, it is necessary to convert UTF-8 in UTF-16! smile

7

Re: How to receive the Chinese language in MessageBox

Eolt wrote:

There is a function which returns in UTF-8 the Chinese phrase.

const char* txt;
txt = china_message ();
MessageBox (0, txt, "", 0);

On an output instead of hieroglyphs here it

To you are simply necessary also the Chinese fonts...

8

Re: How to receive the Chinese language in MessageBox

MasterZiv;
You were late,  UTF-8 instead of UTF-16 submitted
And a font containing Chinese, in Windows for a long time is in standard delivery

9

Re: How to receive the Chinese language in MessageBox

Eolt;
Only here at you in a topic  three it is perfect others a hieroglyph which are distinct from result.

10

Re: How to receive the Chinese language in MessageBox

NekZ wrote:

Eolt;
Only here at you in a topic  three it is perfect others a hieroglyph which are distinct from result.

I changed it already. The first variant is an indecent word on-kitajski smile