0

Many Operating Systems such as Linux and FreeBSD already treats char type as UTF-8, but Windows still treats it as old MBCS. With MBCS, we cannot handle a string with more than three non-alphabet characters such as "안녕你好こんにちはhello".

Is there any way of making my Windows program treat char type as UTF-8 instead of old MBCS? For example, CreateFileA gets file name string of char* as UTF-8, not MBCS. I guess there may be an way of doing it by calling a Win32 function or setting a value in Manifest file.

deceze
  • 510,633
  • 85
  • 743
  • 889
Hyunjik Bae
  • 2,721
  • 2
  • 22
  • 32

1 Answers1

4

Windows 10 (build 17035 and later) supports setting the active codepage of the system locale to UTF-8 ("Use Unicode UTF-8 for worldwide language support"). If you cannot rely on a user configuring this on machines where your application will run then you have to use the old technique; MultiByteToWideChar and CreateFileW.

Anders
  • 97,548
  • 12
  • 110
  • 164