[Issue 15710] New: Replacement for std.utf.validate which does not throw

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Feb 20 22:02:59 PST 2016


https://issues.dlang.org/show_bug.cgi?id=15710

          Issue ID: 15710
           Summary: Replacement for std.utf.validate which does not throw
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: issues.dlang at jmdavisProg.com

For whatever reason, std.utf.validate throws when a string is invalid Unicode
rather than returning true or false (probably because it was easier at the time
it was implemented, since the only wwy to validate Unicode other than
reimplementing decode would have been to catch the exception it threw on
failure). It also only works on strings and not arbitrary ranges of characters.
So, we need a new function (e.g. isValidUnicode) which validates a range of
characters and returns whether it's valid Unicode rather than throwing. Then we
can deprecate validate and get that much closer to getting rid of UTFException
and all of the extraneous Unicode validation that we have right now.

--


More information about the Digitalmars-d-bugs mailing list