//将Unicode字符转成UTF8的char类型
//函数会为pszDest分配合适的内存
//nDestLen转换后结果的长度
BOOL String2Char(LPCWSTR pszStr, char *&pszDest, int &nDestLen)
{
int __len = WideCharToMultiByte(CP_UTF8, 0, pszStr, -1, NULL, 0, NULL, NULL);
if(__len > 0)
{
pszDest = new char[__len+1];
int nret = WideCharToMultiByte(CP_UTF8, 0, (pszStr), -1, (pszDest), __len, NULL, NULL);
return TRUE;
}
return FALSE;
}