www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15710] New: Replacement for std.utf.validate which does not


          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 puremagic.com
          Reporter: issues.dlang 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.

Feb 20 2016