Answer the question
In order to leave comments, you need to log in
Why are hieroglyphs displayed instead of Russian in WinAPI?
I want to display a message using a MessageBox. there is Russian. on the box itself, instead of text, hieroglyphs. I heard that this is due to encodings, but I don’t understand what I did wrong, so in addition to the solution, I would like to explain about encodings (that is, in what encoding of the string in the project, which WInAPI uses, how to convert encodings, etc.). p.)
here is the code:
void SendMsg(const wchar_t* msg, const wchar_t* header_text)
{
MessageBox(nullptr, msg, header_text, MB_OK);
}
int main()
{
SendMsg(L"текст", L"заголовок");
}
Answer the question
In order to leave comments, you need to log in
MessageBox can connect as MessageBoxA, requiring a one-byte encoding; or as MessageBoxW for unicode. The L prefix declares a unicode string. When compiling, there are no warnings about type casting? Possibly configured to use MessageBoxA. you can explicitly specify MessageBoxW. Although no, with such an error it would not compile.
Maybe the point is in what encoding the compiler understands the source code file:
https://qna.habr.com/q/525512
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question