将字符流转换为Unicode [英] Converting character streams to Unicode

查看:86
本文介绍了将字符流转换为Unicode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MultiByteToWideChar似乎不是用于将DBCS或UTF-8流转换为UTF-16的适当API,因为它在其源缓冲区中需要整数个这些字符.但是,.Net具有Decoder类,其记录如下:

MultiByteToWideChar does not seem to be an appropriate API for converting DBCS or UTF-8 streams to UTF-16, because it requires an integral number of those characters in its source buffer.  However, .Net has a Decoder class, which is documented as follows:

解码器对象在连续两次调用GetChars或Convert()方法之间维护状态信息,因此它可以正确解码跨越块的字节序列.解码器还在数据块的末尾保留尾随字节,并在下一个解码操作中使用尾随字节.因此,GetDecoder和GetEncoder对于网络传输和文件操作很有用,因为这些操作通常处理数据块而不是完整的数据流.

这正是我所需要的,但是我不想使用.Net.使用PSDK是否可以达到相同的结果?

That's exactly what I need, but I don't want to use .Net.  Is there a way of achieving the same result using the PSDK?

谢谢.

推荐答案

基思,我正在将此线程移到一个更合适的论坛上 .我们正在将该论坛重命名为常规Windows开发问题论坛".谢谢!

Keith, I’m moving this thread to a more appropriate forum to help get the right answers faster.  The Windows SDK forum is for questions about the tools, samples, headers and libraries and documents in the Windows SDK.  General questions about developing for Windows (all versions, not just Vista) belong in the General Windows Vista Development Issues Forum  We’re working on renaming this forum to "General Windows Development Issues Forum." Thanks!

-Karin >

|| Karin Meier Windows SDK PM || 构建环境 . 样本 社区 http://blogs.msdn.com/KarinM ||

||Karin Meier||Windows SDK PM||Build Environment.Samples.Community|| http://blogs.msdn.com/KarinM||


这篇关于将字符流转换为Unicode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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