为 jruby 1.8.2(本机实现)寻找具有规范化器(NFD、NFKD、NFC、NFKC)的 gem
是否有一个本地gem(因此它可以用于jruby 1.8.2)实现UTF8规范化器(NFD,NFKD,NFC,NFKC)?
Is there a native gem (so it can be used for jruby 1.8.2) which implements UTF8 normalizers (NFD, NFKD, NFC, NFKC)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Ruby v1.8 在 Unicode 上确实很不稳定。我发现 v1.9 是进行正常处理的最小 Ruby 版本。即便如此,
unicode_utils
gem for v1.9.1 for better 绝对是不可或缺的。它具有完整的案例映射和标准化功能等功能。你确实需要它。不幸的是,它不包含排序规则,因此您无法进行字母排序 Ruby 可以像 Perl 或语言一样访问 ICU 库。排序规则是最难正确完成的,因此缺少它也就不足为奇了。但这很重要,因为它几乎是我们对文本所做的一切的基础。这不仅仅是排序;这是关于简单的字符串比较。大多数人没有意识到这一点。
我在我的 第三篇文章中讨论了 Ruby 的 Unicode 支持以及如何让您的生活更轻松几周前的 OSCON 谈话。我承认我放弃了 Ruby v1.8;实在是太令人沮丧了。
这并不是对 Ruby 的批评,因为对于当今大多数不是最新版本的语言来说,同样的事情也可以说。
因此,这四种语言的情况与 PHP、Javascript 和 Go 的情况完全不同。对于后者三种语言,你运行什么版本并不重要,因为
您是否有任何可能的方法来使用 Ruby v1.9?
Ruby v1.8 is really flaky on Unicode. I find v1.9 the minimal Ruby version for sane processing. Even then, the
unicode_utils
gem for v1.9.1 for better is absolutely indispensable. It has things like full casemapping and normalization functions. You really do need it.Unfortunately, it doesn’t include collation, so you can’t do alphabetic sorts in Ruby the way you can in Perl or languages with access to the ICU libraries. Collation is the hardest to get right so it is not surprising that it is missing. But it is critical because it underlies nearly everything we ever do with text. It’s not just about sorting; it’s about simple string comparisons. Most people don’t realize this.
I talk about Ruby’s Unicode support and what you can do to make your life easier there a little in my third OSCON talk from a couple weeks ago. I confess that I gave up on Ruby v1.8; it was just too too frustrating.
That’s not a knock against Ruby, because the same thing can be said for most languages today that aren’t the latest versions.
The situation with those four therefore is quite unlike the one(s) with PHP, Javascript, and Go. With those latter three languages, it doesn’t matter what version you run, because
Is there any possible way for you to use Ruby v1.9?