首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

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

2012-10-20 
对字符编码问题,这里给出ice的策略对字符编码问题,这里给出ice的策略:#1 Narrow strings (that is, string

对字符编码问题,这里给出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.

热点排行