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 | |
by Jim (Curate) on Jan 31, 2011 at 08:10 UTC | |
by ikegami (Pope) on Jan 31, 2011 at 08:56 UTC | |
by Jim (Curate) on Jan 31, 2011 at 09:28 UTC | |
by ikegami (Pope) on Jan 31, 2011 at 15:31 UTC | |
| |
by ikegami (Pope) on Jan 31, 2011 at 09:01 UTC | |
by Jim (Curate) on Jan 31, 2011 at 09:39 UTC | |
by ikegami (Pope) on Jan 31, 2011 at 15:14 UTC | |
Re^2: How to reverse a (Unicode) string
by Anonymous Monk on Jan 24, 2011 at 03:56 UTC |