The standard does not specify the encoding for narrow or wide strings. Typically, the supplier is committed to something that is not surprising on the target machine, but hard to say more. This means, for example, that a narrow string is likely to use ASCII (or, indeed, something like ISO-8859) on most personal computers, but EBCDIC on the IBM mainframe.
Wide character strings also vary - for example, most compilers on Windows will use UTF-16. On Linux, UTF-32 / UCS-4 is probably more common.
Mentioning MessageBox offers Windows, where (you guessed it) you will usually have UTF-16 for wide lines. In this case, if you explicitly specify wide strings, you also want to explicitly specify the wide version of the function - MessageBoxW .
Regarding the creation of the UTF-8 string literal, all I can say is “luck”. This will be related to Visual Studio, but if there is a way to do this, I don't know about that.
Jerry Coffin
source share