[Issue 7085] std.algorithm.reverse() problem with Unicode dchar[]

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 9 02:36:06 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=7085


Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jmdavisProg at gmx.com
         Resolution|                            |INVALID


--- Comment #1 from Jonathan M Davis <jmdavisProg at gmx.com> 2011-12-09 02:36:00 PST ---
No, this behavior is as-designed. You're misunderstanding dchars. A dchar is a
UTF-32 code unit, which is then guaranteed to be a code point. When you reverse
a range of dchar - be it a dchar[] or some other data structure - the code
points are reversed. It doesn't take graphemes into account _at all_. If you
want to reverse a string based an graphemes, you need to have a range of
graphemes not a range of dchar. Phobos does not currently have support for a
range of graphemes, which makes that quite a bit harder to do, but until then,
all ranges of characters are ranges of dchar, and any function which operates
on a range is going to treat them as ranges of dchar, not graphemes, so reverse
is going to reverse code points, even if that's not what the programmer really
wanted.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list