in reply to How to reverse a (Unicode) string
The documentation of Perl's reverse function states: "In scalar context, [the reverse function] ... returns a string value with all characters in the opposite order." But it doesn't, at least not for a sufficiently modern, multilingual, Unicode-conformant definition of "character." It reverses Unicode code points, not characters in the usual, well-understood sense of the word.
One or the other is wrong: the behavior of the reverse function or the reverse function's documentation.
If I understand the design principles of Perl correctly, the reverse function should properly reverse extended grapheme clusters when the thing being reversed is Unicode text (and Perl understands it is Unicode text), and it should reverse bytes otherwise.
|Replies are listed 'Best First'.|
Re^2: Repurposing reverse
by ikegami (Pope) on Jan 24, 2011 at 06:50 UTC
Re^2: How to reverse a (Unicode) string
by Anonymous Monk on Jan 24, 2011 at 03:56 UTC