汉字在unicode中的编码范围一般为0x4e00 ~ 0x9fa5,所以可以通过判断字符是否在在两者之间来确定是否是汉字编码。代码如下:
bool IsExistHanzi(std::wstring strText)
{
bool bRet = false;
for (int i=0; i<strText.length(); i++)
{
if (strText[i] >= 0x4e00 && strText[i] <= 0x9fa5)
{
bRet = true;
break;
}
}
return bRet;
}