`
monkeycn
  • 浏览: 42786 次
  • 性别: Icon_minigender_1
  • 来自: 福州
文章分类
社区版块
存档分类
最新评论

对字符编码问题,这里给出ice的策略

阅读更多
对字符编码问题,这里给出ice的策略:
#1 Narrow strings (that is, strings mapped to std::string) are presented to
the application in UTF-8 encoding and, similarly, the application is expected
to provide narrow strings in UTF-8 encoding to the Ice run time for transmission.

首先以8位为一个字节的字符格式,例如ascii,gbk,等,就是能在std::string下正常显示的,ice要求用户自己提供从他们自己的平台语言转换为utf8的方法

当然ascii天生兼容utf8,这个不用转.

比如我们的情况,中文版win,用的gbk,那么咱们用ice的时候要提供一个方法,把字符从gbk转换为utf8.



#2 Wide strings (that is, strings mapped to std::wstring) are automatically
encoded as Unicode by the Ice run time as appropriate for the platform. For
example, for Windows, the Ice run time converts between UTF-8 and UTF-16
in little-endian representation whereas, for Linux, the Ice run time converts
between UTF-8 and UTF-32 in the endian-ness appropriate for the host CPU.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics