Bug #15337
closedString#each_grapheme_cluster wrongly splits "\r\n"
Description
The method each_grapheme_cluster
on the String
class wrongly splits CRLF into two clusters, as follows:
[duerst@stazersee ruby2]$ ./ruby -e 'puts "\r\n".each_grapheme_cluster.to_a.inspect'
["\r", "\n"]
[duerst@stazersee ruby2]$ ./ruby -v
ruby 2.6.0dev (2018-11-24 trunk 65950) [x86_64-linux]
The expected result in the above case is:
["\r\n"]
Except for the test cases that contain (unpaired) surrogates, which don't apply for us, this is the only test case that fails when testing with the data at http://www.unicode.org/Public/10.0.0/ucd/auxiliary/GraphemeBreakTest.txt. I have a test script using all that data that I plan to commit as soon as this bug is dealt with.
I would like to make sure that this is correct for Unicode 10.0.0 before moving to Unicode 11.0.0. In both specifications, the CRLF case is listed explicitly first in the specification.
I will try to find out how to fix this by myself, but would definitely appreciate help.