请求各位大哥给出utf8到unicode的算法,在下先表示谢了
解决方案 »
- 我在使用VFW的时候,调试过程中,capDriverConnect()函数,显示user breakpoint called from code at 0xX?
- 怎么让RichEdit控件只能输入数字
- 使用VS2005+Access2007中,在增加新的一行时有两个疑问,请帮忙看看
- 到了散分的时间(一周一次)
- 小小虾拜托大虾帮忙了
- 动态数组问题
- 新手的问题:accept()调用为何未阻塞?---请各位老大多多指点!
- 如何实现象windows画图板中左侧的工具栏,所有的工具成4-5列,
- 急!求Jaguar CTS 的资料。
- 有谁知道怎样使客户端的ActiveX不出安全提示
- 多网卡组播通信绑定IP发送出现的问题
- 界面切换的小问题????
LPCSTR lpSrcStr,
int cchSrc,
LPWSTR lpDestStr,
int cchDest
);哥们用这个API函数吧,直接转
lpSrcStr
[in] Pointer to a null-terminated UTF-8 string to convert.
cchSrc
[in] Specifies the number of characters in the lpSrcStr string.
lpDestStr
[out] Pointer to a buffer that receives the converted Unicode string.
cchDest
[in] Specifies the size, in characters, of the lpDestStr buffer.
Return Values
The return value is the number of characters written to the lpDestStr buffer.If the lpDestStr buffer is too small, GetLastError returns ERROR_INSUFFICIENT_BUFFER.Requirements
Windows NT/2000/XP: Included in Windows NT 4.0 SP4 and later.
Redistributable: Requires Active Directory Client Extension on Windows 95/98.
Header: Declared in Winldap.h.
Library: Use Wldap32.lib
但要include 头文件 Winldap.h, 并且在项目属性里添加 Wldap32.lib的链接,或是直接用#pragma comment( lib, "Winldap" )声明
{
char char_one;
char char_two;
char char_three;
int Hchar;
int Lchar;
char uchar[2];
WCHAR *unicode;
CString string_one;
CString string_two;
CString string_three;
CString combiString;
char_one = *ustart;
char_two = *(ustart+1);
char_three = *(ustart+2);
string_one.Format("%x",char_one);
string_two.Format("%x",char_two);
string_three.Format("%x",char_three);
string_three = string_three.Right(2);
string_two = string_two.Right(2);
string_one = string_one.Right(2);
string_three = HexToBin(string_three.Left(1))+HexToBin(string_three.Right(1));
string_two = HexToBin(string_two.Left(1))+HexToBin(string_two.Right(1));
string_one = HexToBin(string_one.Left(1))+HexToBin(string_one.Right(1));
combiString = string_one +string_two +string_three;
combiString = combiString.Right(20);
combiString.Delete(4,2);
combiString.Delete(10,2);
Hchar = BinToInt(combiString.Left(8));
Lchar = BinToInt(combiString.Right(8));
uchar[1] = (char)Hchar;
uchar[0] = (char)Lchar;
unicode = (WCHAR *)uchar;
return unicode;
}
WCHAR pWstr = new WCHAR[wNum +1];
MultiByteToWideChar(CP_UTF8, 0, pStr, -1, pWstr , wNum);