www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17861] New: UTF Decode fails with exception

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

          Issue ID: 17861
           Summary: UTF Decode fails with exception
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: etcimon gmail.com

When decoding UTF code points, the invalid characters should be replaced by ?
rather than throwing errors. Most uses for a UTF parser are read-only and this
breaks any application for no reason.

ie. the `decode` function should not behave like it's doing a unit test on all
UTF text.

The solution in my program is:

https://github.com/dlang/druntime/blob/master/src/rt/util/utf.d#L292

Should be replaced by: return '?'

--
Sep 26 2017