ruby 1.8.7 中的正则表达式将检测 4 字节 Unicode 字符
谁能告诉我如何在 ruby 1.8.7 中编写 ruby 正则表达式来检测 4 字节 unicode 字符(特别是表情符号)的存在?我正在尝试处理 mysql 默认情况下不这样做的事实,允许您存储 4 字节 emoji unicode 字符,现在 iOS 5 使用。
谢谢!
Can anyone tell me how I would write a ruby regexp in ruby 1.8.7 to detect the presence of a 4-byte unicode character (specifically the emoji)? I am trying to handle the fact that mysql does not, by default, allow you to store 4-byte emoji unicode characters, now in use by iOS 5.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎与表示表情符号的四个字节中的前两个字节匹配。这是在 ruby 1.8.7 中运行的。
This appears to match the first two bytes of the four bytes that represent emoji. This is being run in ruby 1.8.7.
使用非阻塞在线方法更改表可能是可行的,例如 Maatkit 的 online-schema-change: http://www.percona.com/doc/percona-toolkit/pt-online-schema-change.html
来自文档:
Altering the table might be feasible using a non-blocking online approach, e.g. Maatkit's online-schema-change: http://www.percona.com/doc/percona-toolkit/pt-online-schema-change.html
From the docs: