June 30, 2012 [Issue 8322] New: std.string.chomp does not handle combining characters correctly | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-06-29 22:47:40 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: ------- |
June 30, 2012 [Issue 8322] std.string.chomp does not handle combining characters correctly | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | 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 --- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-06-29 23:28:22 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: ------- |
Copyright © 1999-2021 by the D Language Foundation