确定Unicode字符是否可见? [英] Determining if a Unicode character is visible?

查看:223
本文介绍了确定Unicode字符是否可见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个文本编辑器,它有一个选项来显示一个项目符号,代替任何不可见的Unicode字符。不幸的是,似乎没有简单的方法来确定Unicode字符是否是不可见的。

I am writing a text editor which has an option to display a bullet in place of any invisible Unicode character. Unfortunately there appears to be no easy way to determine whether a Unicode character is invisible.

我需要找到一个包含每个Unicode字符的文本文件,对于不可见字符。

I need to find a text file containing every Unicode character in order that I can look through for invisible characters. Would anyone know where I can find such a file?

编辑:我在Cocoa for Mac OS X中编写这个应用程序。

I am writing this app in Cocoa for Mac OS X.

推荐答案

哦,我看到...实际的隐藏字符;)这个FAQ可能是有用的:

Oh, I see... actual invisble characters ;) This FAQ will probably be useful:

a href =http://www.unicode.org/faq/unsup_char.html =nofollow noreferrer> http://www.unicode.org/faq/unsup_char.html

http://www.unicode.org/faq/unsup_char.html

它列出了当前不可见的编码点,并有其他可能有帮助的信息。

It lists the current invisible codepoints and has other information that you might find helpful.

编辑:特定信息

由于您使用的是Cocoa,您可以获取控制字符的unicode字符集,并进行比较:

Since you're using Cocoa, you can get the unicode character set for control characters and compare against that:

NSCharacterSet* controlChars = [NSCharacterSet controlCharacterSet];

您可能还想看看我在上面发布的FAQ链接,认为您可能需要根据控制字符集返回的字符集的信息。

You might also want to take a look at the FAQ link I posted above and add any characters that you think you may need based on the information there to the character set returned by controlCharacterSet.

编辑:添加了一个从Unicode字符创建Unicode字符串的示例

unichar theChar = 0x000D;
NSString* thestring = [NSStirng stringWithCharacters:&theChar length:1];

这篇关于确定Unicode字符是否可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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