[Issue 8890] New: std.algorithm.commonPrefix does not handle unicode correctly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 24 21:31:13 PDT 2012


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

           Summary: std.algorithm.commonPrefix does not handle unicode
                    correctly
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: jmdavisProg at gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-10-24 21:31:11 PDT ---
This code asserts:

import std.algorithm;

void main()
{
    assert(commonPrefix("Пиво", "Пони")== "П");
}

This is because a portion of the code point following 'П' is returned, because
the code units at the beginning of the next code point match, and commonPrefix
fails to take that possibility into account. It basically operates on code
units right now for matching string types rather than operating on code points
as it should.

-- 
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