用于 UTF8 到 1252 的 Windows C API
我熟悉 WideCharToMultiByte 和 MultiByteToWideChar 转换,可以使用它们来做类似的事情:
UTF8 -> UTF16-> 1252章
第
我可能应该引入 iconv 库,但我感觉很懒。
谢谢
I'm familiar with WideCharToMultiByte and MultiByteToWideChar conversions and could use these to do something like:
UTF8 -> UTF16 -> 1252
I know that iconv will do what I need, but does anybody know of any MS libs that will allow this in a single call?
I should probably just pull in the iconv library, but am feeling lazy.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Windows 1252 基本上等同于 latin-1,又名 ISO-8859-1:Windows-1252 只是在 latin-1 保留范围 128-159 中分配了一些附加字符。如果您准备忽略这些额外的字符并坚持使用 latin-1,那么转换相当容易。试试这个:
请注意,我对此代码不保证。这是完全未经测试的。
Windows 1252 is mostly equivalent to latin-1, aka ISO-8859-1: Windows-1252 just has some additional characters allocated in the latin-1 reserved range 128-159. If you are ready to ignore those extra characters, and stick to latin-1, then conversion is rather easy. Try this:
Note that I make no guarantee about this code. This is completely untested.