IsTextUnicode似乎已被破坏 [英] IsTextUnicode appears to be broken

查看:62
本文介绍了IsTextUnicode似乎已被破坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 - 我尝试使用IsTextUnicode在没有BOM的文本文件中区分UTF16(小端)和UTF16(大端),它似乎完全坏了。使用大端和小端格式的1000字节文本的样本,以及调用的多种变体
,无论我做什么,我都无法返回可用的结果。 在互联网上搜索我发现这似乎是一个众所周知的事情。我在某个地方读到了这个函数确实可以正常工作,但仅限于未编译为
启用了Unicode的应用程序(我的是)。 微软是否承认过这个问题? 如果是的话,有没有计划修复它? 我已经放弃尝试使用IsTextUnicode,而是不得不求助于使用我自己的本土变体。 
但它非常简单,如果有效,我宁愿使用IsTextUnicode。


P.S。文档讨论了"反向字节",我发现这很令人困惑。  "反向字节"结果表示"小端" - 即Windows的标准。 然而,这与主要问题无关,即它只是不会出现
工作。




Simon

解决方案

您好,


也许此链接有助于理解这一点,也可以查看表格。某处是链接到一些免费的转换器,所以这也可以解决方案,只需检查代码:


http://unicode.org/faq/utf_bom.html



Hi - I tried to use IsTextUnicode to distinguish UTF16 (little endian) from UTF16 (big endian) in text files with no BOM, and it appears to be completely broken. Using samples with 1000 bytes of text in big-endian and little-endian format, and numerous variants on the calls, I couldn't get it to return usable results whatever I did.  Searching on the Internet I found that this appears to be a well-known thing. I read somewhere that the function does work OK but only in apps which are not compiled as Unicode-enabled (which mine is).  Have Microsoft ever acknowledged this problem?  If so, are there any plans to fix it?  I have given up trying to use IsTextUnicode and have instead had to resort to using my own home-grown variant instead.  But it's very unsophisticated, and I'd rather use IsTextUnicode if it worked.

P.S. The documentation talks about 'reverse bytes', which I found very confusing.  'Reverse bytes' turns out to mean 'little endian' - i.e. the norm for Windows.  However, that's not relevant to the main problem which is that it just doesn't appear to work.


Simon

解决方案

Hello,

maybe this link can help to understand that, look also to table. Somewhere is link to some free converter, so this can be also solution, simply check code:

http://unicode.org/faq/utf_bom.html


这篇关于IsTextUnicode似乎已被破坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆