www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8322] New: std.string.chomp does not handle combining characters correctly

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

           Summary: std.string.chomp does not handle combining characters
                    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



PDT ---
These two succeed:

assert(equal(chomp("hello \u00E9", "\u00E9"), "hello "));
assert(equal(chomp("hello e\u0301", "e\u0301"), "hello "));

These two fail:

assert(equal(chomp("hello \u00E9", "e\u0301"), "hello "));
assert(equal(chomp("hello e\u0301", "\u00E9"), "hello "));

It's because chomp makes the erroneous assumption that if a string ends with
the delimiter, the code points match exactly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 29 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8322


Jonathan M Davis <jmdavisProg gmx.com> changed:

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



PDT ---
Scratch this. I was thinking that endsWith was returning true for these and
then incorrectly slicing the string when the delimiter was a different set of
code points for the saem thing, which would result in it being incorrectly
sliced. However, endsWith does _not_ return true for these, because it's
operating on code points just like chomp is. In both cases, the strings must be
normalized for this to work properly. chomp isn't broken.

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