主要是不知道怎么把UTF 8编码的文本读进程序里 如把值付给变量CString word;

解决方案 »

  1.   

    1、头三个字节从文件中读取的时候在 windows 环境下比较特殊;仅仅用于格式检查;2、读入之后,使用 MultiByteToWideChar(CP_UTF8, ...) 可以转换成 unicode 字符串;3、使用 WideCharToMultiByte(CP_ACP, ...) 可以将 unicode 字符串转换成 ANSI 字符串。
      

  2.   

    int needlen = MultiByteToWideChar( CP_UTF8, 0, ( char * )utf8hex, -1, NULL, 0 );
    if( needlen < 0 )
    {
    return needlen;
    } result = MultiByteToWideChar( CP_UTF8, 0, ( char * )utf8hex, -1, unicodestr, needlen + 1 );
    int needlen = WideCharToMultiByte( CP_ACP, 0, unicodestr, -1, NULL, 0, NULL, NULL );
    if( needlen < 0 )
    {
    return needlen;
    } result = WideCharToMultiByte( CP_ACP, 0, unicodestr, -1, ansistr, needlen + 1, NULL, NULL );
      

  3.   

    问题是应该怎么把utf 8编码的文本读入程序啊,用ifsteam还是CFile
      

  4.   

    用ifsteam读进来是乱码啊大哥门!!
      

  5.   

    MultiByteToWideChar(CP_UTF8,...);
    将UTF8转成Unicode
    然后调用
    WideCharToMultiByte(CP_ACP,...);
    将Unicode转成多字节编码