MultiByteToWideChar 和 WideCharToMultiByte 中第1个参数的理解
MSDN说:Specifies the code page to be used to perform the conversion,
我的理解是:这2个都是多字符集中的某一个(如ansi或是utf-8)转成宽字符(unicode),
如:
int len=MultiByteToWideChar(CP_UTF8,0,str,-1,0,0);//请求WCHAR字符数
以上是代表“多字符集”转成“宽字符,这个多字符为UTF-8 ,好理解吧?呵呵
::MultiByteToWideChar(CP_ACP, NULL, szAnsi, strlen(szAnsi), wszString, wcsLen);
以上是 将 多字符集转成宽字符,,这个多字符集中的哪一个呢?CP_ACP来告诉你,是ansi。
::WideCharToMultiByte(CP_ACP, NULL, wszString, wcslen(wszString), szAnsi, ansiLen, NULL, NULL);
意思是:将宽字符 转成 多字符集中的ansi
::WideCharToMultiByte(CP_UTF8, NULL, wszString, wcslen(wszString), szU8, u8Len, NULL, NULL);
意思是:将宽字符 转成 字符集中的UFT-8码
特此记录,不混乱!