How to Output Unicode Strings on the Windows Console

后端 未结 4 1244
独厮守ぢ
独厮守ぢ 2020-11-28 13:48

there are already a few questions relating to this problem. I think my question is a bit different because I don\'t have an actual problem, I\'m only asking out of academic

4条回答
  •  醉话见心
    2020-11-28 14:23

    How I correcty work is as follows:

    • Use UTF-16 and wchar_t internally, this works nicely with filenames and Windows API in general.
    • Set codepage to 65001, which is UTF-8. This ensures that when you read plaintext files, windows checks them for UTF-16 and BOM, ("the Windows standard"), and if no BOM, the text will be treated as UTF-8 ("the world standard") and translated to UTF-16 for your use.

提交回复
热议问题