for(int i = 0; i < nlength/2; i++)
*((unsigned short*)lpszw + i) = ntohs(*((unsigned short*)lpszw + i));
nlen = widechartomultibyte(936, wc_compositecheck,
(const unsigned short*)lpszw, nlength/2, null, 0, null, null);
lpszm = new byte[nlen+1];
nlen = widechartomultibyte(936, wc_compositecheck,
(const unsigned short*)lpszw, nlength/2, (char*)lpszm, nlen, null, null);
lpszm[nlen] = 0;
cstring cssm((lpctstr)lpszm, nlen);
delete lpszm;
delete lpszw;
return cssm;
}
/*****************************************************************************
* class : global function
* function : to_ucs2
* description: 把多字节转换成unicode
* parameters : char* strsm -- -- 要转换的多字节缓冲
* int nlength -- 多字节缓冲的长度
* return : 转换后的unicode字串
******************************************************************************/
cstring to_ucs2(char* strsm, int nlength){
cstring cssm((lpctstr)strsm, nlength);
pbyte lpszw = null;
uint nlen = 0;
nlen = multibytetowidechar(936, mb_precomposed,
(lpctstr)cssm, cssm.getlength(), null, 0);
lpszw = new byte[nlen * 2];
nlen = multibytetowidechar(936, mb_precomposed,
(lpctstr)cssm, cssm.getlength(), (lpwstr)lpszw, nlen);
for(uint i = 0; i < nlen; i ++)
*((unsigned short*)lpszw + i) = htons(*((unsigned short*)lpszw + i));
cstring csret((lpctstr)lpszw, nlen * 2);
delete lpszw;
return csret;
}
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器