Open hikari-no-yume opened 9 years ago
Depending on your use case though, the algorithm may not be sufficient, sadly. See https://github.com/mathiasbynens/esrever/issues/5.
Ah, that's unfortunate. PHP has grapheme_
functions for manipulating grapheme clusters, and that just uses ICU I believe, so we can probably just use ICU's handling of this.
Since it doesn't look like this'll be fixed in time for PHP 7's release, I suggest we rename the function and explicitly note in the documentation that it doesn't care for combining chars etc.
That way, we won't break anything if we later introduce a better algorithm.
Currently, string reversal works on code points, it doesn't care what kind. So it won't reverse strings containing combining characters properly.
We could quite simply implement the Missy Elliot algorithm that @mathiasbynens came up with, and then it'd do what people expect.
Thoughts?