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

前端 未结 4 685
时光取名叫无心
时光取名叫无心 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条回答
  •  日久生厌
    2020-12-06 01:05

    Michael Kaplan, an internationalization expert from Microsoft, tried to answer this on his blog.

    Basically his explanation is that even though the "ANSI" versions of Windows API functions are meant to handle different code pages, historically there was an implicit expectation that character encodings would require at most two bytes per code point. UTF-8 doesn't meet that expectation, and changing all of those functions now would require a massive amount of testing.

提交回复
热议问题