2012年(158)
分类: C/C++
2012-11-23 17:03:12
#include
#include
int main()
{
const char* p = "7 4 3 3 8 3 2 5 2 5 0 5 3 5 3 1
";
const size_t n = strlen(p);
int result = -1;
if( IsTextUnicode(p,n,&result) )
{
switch( result )
{
case
IS_TEXT_UNICODE_STATISTICS:
printf( "%s\n",
"根据统计分析,这段文字可能是Uincode编码" );
break;
}
}
return 0;
}
网友评论2012-11-23 17:03:49
yqever
The problem with text files is that there are no hard and fast rules as to their content. This makes it extremely difficult to determine whether the file contains ANSI or Unicode characters. IsTextUnicode uses a series of statistical and deterministic methods in order to guess at the content of the buffer. Because this is not an exact science, it is possible that IsTextUnicode will return an incorrect result.