Why isn't UTF-8 allowed as the “ANSI” code page?

前端 未结 4 687
时光取名叫无心
时光取名叫无心 2020-12-06 00:17

The Windows _setmbcp function allows any valid code page...

(except UTF-7 and UTF-8, which are not supported)

OK, not supporting UTF

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 00:57

    _setmbcp() is a VC++ RTL function, not a Win32 API function. It only affects how the RTL interprets strings. It has no effect whatsoever on Win32 API A functions. When they call their W counterparts internally, the A functions always use MultiByteToWideChar() and WideCharToMultiByte() specifying codepage 0 (CP_ACP) to use the system default Ansi codepage for the conversions.

提交回复
热议问题