- u8:使用utf8编码
- u:16bit宽字符常量,以16bit为编码单位(如:UTF-16)
- U:32bit宽字符常量,以32bit为编码单位(如:UTF-32)
使用示例:
char u8s[] = u8"中文";
char16_t u16s[] = u"中文";
char32_t u32s[] = U"中文";
wchar_t ws[] = L"中文";
cout << sizeof(u8s)<<endl;
cout << sizeof(u16s)<<endl;
cout << sizeof(u32s)<<endl;
cout << sizeof(ws)<<endl;
网友评论