[Issue 17861] UTF Decode fails with exception

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 27 01:08:21 UTC 2017


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

Jon Degenhardt <jrdemail2000-dlang at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jrdemail2000-dlang at yahoo.co
                   |                            |m

--- Comment #7 from Jon Degenhardt <jrdemail2000-dlang at yahoo.com> ---
(Not sure a bug is the correct place to discuss, but...)

In many of the apps I work on it's important that the application have control
over the error handling behavior when an invalid UTF-8 sequence is encountered.
Any time data is received from an external source. When using Phobos, it's
often necessary to do this validation on initial input without giving control
to Phobos routines. This is not always the most convenient.

What would be really useful would be to have some sort of configurable utf-8
error handling setting that could be established for a scope. e.g. When
entering a scope, set the invalid character behavior to replace, drop, or
throw. The low level routines like std.utf.decode would obey the settings. When
exiting the scope the previous error handling setting would be re-established.

A somewhat similar idea came up in a forum thread recently with respect to
establishing the precision used converting floating point numbers to strings
with std.conv.to
(https://forum.dlang.org/thread/xlbiekgdijcxwqjsrika@forum.dlang.org).

Don't know how hard something like this would be, perhaps prohibitively hard,
but it would be very pragmatic for many production applications.

--


More information about the Digitalmars-d-bugs mailing list