_bstr_t到UTF-8可能? [英] _bstr_t to UTF-8 possible?
本文介绍了_bstr_t到UTF-8可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 _bstr_t
字符串,其中包含日语文本。我想将此字符串转换为定义为 char *
的UTF-8字符串。
I have a _bstr_t
string which contains Japanese text. I want to convert this string to a UTF-8 string which is defined as a char *
.
将 _bstr_t
字符串转换为 char *
(UTF-8)字符串而不丢失日语字符?
Can I convert the _bstr_t
string to char *
(UTF-8) string without losing the Japanese characters?
推荐答案
使用WideCharToMultiByte() - 传递CP_UTF8作为第一个参数。
Use WideCharToMultiByte() – pass CP_UTF8 as the first parameter.
可以是一个空指针,并对应一个空字符串 - 把这个特殊情况。
Beware that BSTR can be a null pointer and that corresponds to an empty string – treat this as a special case.
这篇关于_bstr_t到UTF-8可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文