Thread overview
[Issue 8890] New: std.algorithm.commonPrefix does not handle unicode correctly
Oct 25, 2012
Jonathan M Davis
Oct 25, 2012
Jonathan M Davis
Jan 07, 2013
Jonathan M Davis
Jan 07, 2013
Jonathan M Davis
October 25, 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@puremagic.com
        ReportedBy: jmdavisProg@gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg@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: -------
October 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8890



--- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-10-24 22:37:26 PDT ---
https://github.com/D-Programming-Language/phobos/pull/889

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8890



--- Comment #2 from github-bugzilla@puremagic.com 2013-01-04 15:02:33 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/dd5eb5ff97736ecaec525488413382f94c0053ea Fix for issue# 8890: commonPrefix does not handle unicode correctly.

It was returning partial code points if the first few code units in a code point matched but not the entire code point.

https://github.com/D-Programming-Language/phobos/commit/2aa1295f4d1b884713e7465b4c1f48d926d936b3 Merge pull request #889 from jmdavis/8890

Fix for issue# 8890: commonPrefix does not handle unicode correctly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8890


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8890


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lxyd.dlang@lxyd.net


--- Comment #3 from Jonathan M Davis <jmdavisProg@gmx.com> 2013-01-07 02:14:01 PST ---
*** Issue 8754 has been marked as a duplicate of this issue. ***

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