Always std.utf.validate, or rely on exceptions?

SimonN via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 2 10:05:31 PST 2017


ketmar wrote:
> i'd say: "ALWAYS validate before ANY further processing".

On Thursday, 2 March 2017 at 17:03:01 UTC, Kagamin wrote:
> 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.

Thanks. Now, I still call std.stdio.byLine or std.stdio.lines on 
the raw data, this seems robust with random binary blobs. Then, I 
validate each line before calling anything else.

-- Simon


More information about the Digitalmars-d-learn mailing list