且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

混淆关于C ++的std :: wstring,UTF-16,UTF-8和在Windows GUI中显示字符串

更新时间:2023-11-14 20:13:46

Windows NT4以上的版本可能有疑问我的解释可能使用澄清,所以我会尝试提供。是基于Unicode编码的字符串,是的。早期版本基于UCS-2,它是前身或UTF-16,因此不支持UTF-16的所有字符。后来的版本基于UTF-16。不是所有的操作系​​统都基于UTF-16 / UCS-2。例如,* nix系统基于UTF-8。

Windows from NT4 onwards is based on Unicode encoded strings, yes. Early versions were based on UCS-2, which is the predecessor or UTF-16, and thus does not support all of the characters that UTF-16 does. Later versions are based on UTF-16. Not all OSes are based on UTF-16/UCS-2, though. *nix systems, for instance, are based on UTF-8 instead.

UTF-8是永久存储数据的一个很好的选择。它是在所有Unicode环境中普遍支持的编码,它是数据大小和无损数据兼容性之间的良好平衡。

UTF-8 is a very good choice for storing data persistently. It is a universally supported encoding in all Unicode environments, and it is a good balance between data size and loss-less data compatibility.

是的,您必须解析XML,从中提取必要的信息,并将其解码并转换为UI可以使用的东西。

Yes, you would have to parse the XML, extract the necessary information from it, and decode and transform it into something the UI can use.