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

--- Comment #25 from Vladimir Panteleev <thecybersha...@gmail.com> ---
(In reply to Martin Nowak from comment #24)
> If we validate encoding on data entry points such as readText or byLine,
> then decoding errors should be assertions rather than silent replacements,
> because it's a programming error to use unvalidated data as string.

Although I think this approach is acceptable (as long as the program halts
regardless of compilation flags, which shouldn't be a problem), I would like to
note that there are situations in which it is impractical to either convert or
validate the data. One example is implementations of text-based network
protocols (e.g. HTTP, NNTP, SMTP). Here, neither converting everything to UTF-8
or verifying that it is valid UTF-8 works, because text-based protocols often
embed raw binary data. The program only needs to parse the ASCII text parts, so
the ideal solution would be a string handling library which never decodes UTF-8
(something D doesn't have).

--

Reply via email to