ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: duerst@it.aoyama.ac.jp
To: ruby-core@ruby-lang.org
Subject: [ruby-core:90149] [Ruby trunk Bug#15343] String#each_grapheme_cluster wrongly splits some emoji (genie, zombie, wrestling)
Date: Thu, 29 Nov 2018 04:12:28 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-75265.20181129041226.23649ca3ff2db202@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15343.20181126090234@ruby-lang.org

Issue #15343 has been updated by duerst (Martin Dürst).


Some data points from a discussion between @naruse and myself:

- Up to elf (U+1F9DD) is Emoji_Modifier_Base, but genie (U+1F9DE) isn't.

- Emoji_Modifier only includes skin tones (U+1F3FB-1F3FF, light skin tone..dark skin tone)

- For experts, that seems to make sense, because there are apparently light and dark elves, but all the zombies have the same half-dead skin color.

- For 'wrestling' again, it doesn't allow skin colors.

- So the error seems to appear when an emoji takes male/female specifiers, but isn't allowed to take skin tones.

- As we are going to rewrite the underlying implementation (function `node_extended_grapheme_cluster` in regparse.c), we may not care to fix this bug anymore. But if somebody finds a fix, they may want to apply it to older versions of Ruby (2.5 and 2.4).



----------------------------------------
Bug #15343: String#each_grapheme_cluster wrongly splits some emoji (genie, zombie, wrestling)
https://bugs.ruby-lang.org/issues/15343#change-75265

* Author: duerst (Martin Dürst)
* Status: Open
* Priority: Normal
* Assignee: naruse (Yui NARUSE)
* Target version: 2.6
* ruby -v: ruby 2.6.0dev (2018-11-26 trunk 65989) [x86_64-cygwin]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
All the codepoint combinations that turn up in the various emoji files provided by Unicode (currently we use those at https://www.unicode.org/Public/emoji/5.0/) are recognized as grapheme clusters by `String#each_grapheme_cluster`, except those relating to genies, zombies, and wrestling (THIS IS NOT A JOKE!).

Taking an example from https://www.unicode.org/Public/emoji/5.0/emoji-zwj-sequences.txt, line 396:

```
$ ./ruby -e '"\u{1F9DE 200D 2640 FE0F}".each_grapheme_cluster.to_a.length.display'
2
```
The correct result is 1, not 2. The sequence of codepoints represents a woman genie.

I will commit the file test/ruby/enc/test_emoji_breaks.rb, which excludes genie, zombie, and wrestling emoji to make sure the tests pass.

I would like to make sure that this is correct for Unicode 10.0.0 before moving to Unicode 11.0.0. I will try to find out how to fix this by myself, but would definitely appreciate help.




-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2018-11-29  4:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15343.20181126090234@ruby-lang.org>
2018-11-26  9:02 ` [ruby-core:90073] [Ruby trunk Bug#15343] String#each_grapheme_cluster wrongly splits some emoji (genie, zombie, wrestling) duerst
2018-11-26 20:12 ` [ruby-core:90079] " shevegen
2018-11-29  4:12 ` duerst [this message]
2018-11-30  5:15 ` [ruby-core:90184] " duerst
2018-12-02 10:27 ` [ruby-core:90222] [Ruby trunk Bug#15343][Closed] " duerst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-75265.20181129041226.23649ca3ff2db202@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).