读书人

wchar_t到底是存储unicode还是utf-8是

发布时间: 2012-04-17 15:06:33 作者: rapoo

wchar_t到底是存储unicode还是utf-8是编译器决定的吗?
windows就存unicode?linux上面就存utf-8?

[解决办法]
我一直认为 wchar_t存的是utf-16,即你说的unicode,不知是否达人有不同意见
[解决办法]
是由系统正在使用的字符集决定的
[解决办法]
wchar_t应该是utf-16
[解决办法]
wchar_t windows上是utf-16,在linux上实现是utf-32
[解决办法]
编译器只决定以宽字符存储,至于是什么就不一定了,
[解决办法]
编译器只决定以宽字符存储,至于是什么就不一定了,
[解决办法]
通常utf8编码一个汉字占三个字节
[解决办法]
由实现定义:
ISO C++11
2.3/3
...The execution character set and the execution wide-character set are implementation-defined supersets of the basic execution character set and the basic execution wide-character set, respectively. The values of the members of the execution character sets and the sets of additional members are locale-specific.
另外,如果是双字节wchar_t,只能直接表示UCS-2。UTF-16中的另外一些字符用一个wchar_t也放不下。

读书人网 >C++

热点推荐