这些 Unicode 组合字符是怎么回事,我们如何过滤它们? [英] What's up with these Unicode combining characters and how can we filter them?

查看:30
本文介绍了这些 Unicode 组合字符是怎么回事,我们如何过滤它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

กิิิิิิิิิิิิิิิิิิิิก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ก็็็็็็็็็็็็็็็็็็็็กิิิิิิิิิิิิิิิิิิิิก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็กิิิิิิิิิิิิิิิิิิิิก้้้้้้้้้้้้้้้้้้้้กิิิิิิิิิิิิิิิิิิิิก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ก็็็็็็็็็็็็็็็็็็็็กิิิิิิิิิิิิิิิิิิิิก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็กิิิิิิิิิิิิิิิิิิิิก้้้้้้้้้้้้้้้้้้้้

กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ ก็็็็็็็็็็็็็็็็็็็็ ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ ก็็็็็็็็็็็็็็็็็็็็ ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้

这些最近出现在 Facebook 评论部分.

These recently showed up in facebook comment sections.

我们如何消毒?

推荐答案

这些 un​​icode 字符是怎么回事?

What's up with these unicode characters?

这是一个带有一系列组合字符的字符.因为有问题的组合字符想要超过基本字符,所以它们堆叠起来(字面意思).例如

That's a character with a series of combining characters. Because the combining characters in question want to go above the base character, they stack up (literally). For instance, the case of

ก้้้้้้้้้้้้้้้้้้้้

ก้้้้้้้้้้้้้้้้้้้้

...这是一个 ก(泰国字符 ko kai)(U+0E01) 后跟 20 个泰语组合字符 mai tho (U+0E49).

...it's an ก (Thai character ko kai) (U+0E01) followed by 20 copies of the Thai combining character mai tho (U+0E49).

我们如何消毒?

可以预处理文本并限制可应用于单个字符的组合字符的数量,但这种努力可能不值得.你需要所有当前字符的数据表,这样你才能知道它们是组合还是什么,并且你需要确保至少允许一些,因为有些语言在一个基础上写有几个变音符号.现在,如果您想将注释限制为拉丁字符集,这将是一个更简单的范围检查,但当然,如果您想将注释限制为几种语言,那当然只是一个选项.更多信息、代码表等,请访问 unicode.org.

You could pre-process the text and limit the number of combining characters that can be applied to a single character, but the effort may not be worth the reward. You'd need the data sheets for all the current characters so you'd know whether they were combining or what, and you'd need to be sure to allow at least a few because some languages are written with several diacritics on a single base. Now, if you want to limit comments to the Latin character set, that would be an easier range check, but of course that's only an option if you want to limit comments to just a few languages. More information, code sheets, etc. at unicode.org.

顺便说一句,如果你想知道某个字符是如何组成的,对于另一个问题,我最近编写了一个 quick-and-dirty "Unicode ShowJSBin 上的我"页面.您只需将文本复制并粘贴到文本区域中,它就会向您显示组成文本的所有代码点(~字符),以及上面描述每个字符的页面的链接.它仅适用于范围 U+FFFF 及以下的代码点,因为它是用 JavaScript 编写的,并且要处理 JavaScript 中 U+FFFF 以上的字符,您必须为该问题做比我想做的更多的工作(因为在 JavaScript 中,字符"总是 16 位,这意味着对于某些语言,一个字符可以分成两个单独的 JavaScript字符",我没有考虑到这一点),但它对大多数文本很方便..

BTW, if you ever want to know how some character was composed, for another question just recently I coded up a quick-and-dirty "Unicode Show Me" page on JSBin. You just copy and paste the text into the text area, and it shows you all of the code points (~characters) that the text is made up of, with links such as those above to the page describing each character. It only works for code points in the range U+FFFF and under, because it's written in JavaScript and to handle characters above U+FFFF in JavaScript you have to do more work than I wanted to do for that question (because in JavaScript, a "character" is always 16 bits, which means for some languages a character can be split across two separate JavaScript "characters" and I didn't account for that), but it's handy for most texts...

这篇关于这些 Unicode 组合字符是怎么回事,我们如何过滤它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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