Chinaunix首页 | 论坛 | 博客
  • 博客访问: 903317
  • 博文数量: 158
  • 博客积分: 4380
  • 博客等级: 上校
  • 技术积分: 2367
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-21 10:45
文章分类

全部博文(158)

文章存档

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;
}

阅读(1852) | 评论(6) | 转发(0) |
给主人留下些什么吧!~~

网友评论2012-11-23 17:04:24

J
还真是这么回事,应该是内部解析的问题吧
感觉有些常用但不常更新的软件,在早期多多少少有些地方是敷衍过去的,并没有经过认真的测试

网友评论2012-11-23 17:04:15

sjdev
UE没问题,应该是记事本的问题。

网友评论2012-11-23 17:04:05

AAAA
换其它的文本编辑工具就不会显示乱码,说明微软的产品BUG不少啊,连个小小的notepad也有bug

网友评论2012-11-23 17:03:57

conry
说明记事本在字符判断上还有问题
就像原来的“联通”问题一样

网友评论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.