I have a program in which I have been printing normal ASCII strings on screen using TextOut()
. I now want to add the capability of printing out Shift-JIS encoded strings. Can I somehow tell TextOut()
that I want to print a Shift-JIS string or do I have to use another function altogether? The documentation for TextOut seems to make no mention of encoding.
FYI: My program is currently compiled with MS visual studio 2015 and the "Character Set" is set to "Use Multi-Byte Character Set".
Thanks to andlabs, here's the complete answer. This works when the program is compiled with "Character Set" set to "Use Multi-Byte Character Set". I did not want to compile with the "character set" set to unicode as this would disrupt too much existing code.
char shift_jis_string[MAX_STR_LEN]; // null terminated
// blah blah, setting shift_jis_string
WCHAR unicode_string[MAX_STR_LEN];
int n = MultiByteToWideChar(932,0,shift_jis_string,-1,unicode_string,MAX_STR_LEN);
TextOutW(hdc,X,Y, unicode_string, n); // note the W on the end