www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11712] New: Unicode bug in std.string.inPattern

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11712

           Summary: Unicode bug in std.string.inPattern
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: qznc web.de



The following assert fails, but should not.

assert(!inPattern('a', "äöüa-z"));

The problem is the combination of "foreach (size_t i, dchar p; pattern)" with
"i + 1 < pattern.length". Due to foreach "i" is the index of the code point,
but the comparison assumes an index of code unit. The pattern string consists
of 6 code points, but 9 code units.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 09 2013
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11712


qznc web.de changed:

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



Sorry, confusion on my part. The assertion is wrong, inPattern is correct.

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