UTF-16 codecvt facet [英] UTF-16 codecvt facet

查看:186
本文介绍了UTF-16 codecvt facet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于语言区域的问题进行了扩展

并在这个问题:我真正想要做的是安装一个codecvt facet到语言环境它了解UTF-16文件。



我可以写我自己的。但我不是一个UTF专家,因此我相信我会得到几乎正确;但它会在最不方便的时候打破。所以我想知道是否有任何资源(在网络上)预构建codecvt(或其他)方面,可以从C ++使用同行评审和测试?



原因是默认语言环境(在我的系统MAC OS X 10.6)读取文件只是将1字节转换为1 wchar_t无转换。因此,将UTF-16编码文件转换为包含许多空('\0')个字符的wstrings。

解决方案

I不知道如果是网络上的资源你的意思是免费的,但有 Dinkumware Conversions Library ,只要该库可以集成到您的编译器套件中即可。 p>

codecvt 类型在 代码转换


Extending from this questions about locales
And described in this question: What I really wanted to do was install a codecvt facet into the locale that understands UTF-16 files.

I could write my own. But I am not a UTF expert and as such I am sure I would get it nearly correct; but it would break at the most inconvenient time. So I was wondering if there are any resources (on the web) of pre-build codecvt (or other) facets that can be used from C++ that are peer reviewed and tested?

The reason is the default locale (on my system MAC OS X 10.6) when reading a file just converts 1 byte to 1 wchar_t with no conversion. Thus UTF-16 encoded files are converted into wstrings that contain lots of null ('\0') characters.

解决方案

I'm not sure if by "resources on the Web" you meant available free of cost, but there is the Dinkumware Conversions Library that sounds like it will fit your needs -- provided that the library can be integrated into your compiler suite.

The codecvt types are described in the section Code Conversions.

这篇关于UTF-16 codecvt facet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆