On Thursday, 2 March 2017 at 16:20:30 UTC, SimonN wrote:
Should I always validate text from files manually with std.utf.validate?

Or should I memorize which functions throw, then validate manually whenever I call the non-throwing UTF functions? What is the pattern behind what throws and what asserts false?

If you expect file with malformed utf that can cause you trouble and want to handle it gracefully, pass its content through validator and catch exception from validator. Functions working with strings usually assume valid utf and can behave incorrectly on malformed utf.

Reply via email to