网上都说用IsTextUnicode来判断,可是我用它怎么测试都不行,不管是否是UTF-8都返回0请问哪位曾经用过它么??还有,你调用的方式是什么样的?我的是:
      if (IsTextUnicode(foo.GetBuffer(0), foo.GetSize(), NULL))
      {
         ...
      }

解决方案 »

  1.   

    我试过IsTextUnicode也不准, 此外实际应用中的unicode种类有好几种, utf-8只是其中一种好象只凭CString的内容是无法完全正确判断哪种编码的吧?
      

  2.   

    最后一个参数给null
    当然不行了lpi 
    [in/out] On input, specifies the tests to be applied to the input buffer text. On output, receives the results of the specified tests: 1 if the contents of the buffer pass a test, zero for failure. Only flags that are set upon input to the function are significant upon output. 
    If lpi is NULL, the function uses all available tests to determine whether the data in the buffer is likely to be Unicode text.