On Thursday, 17 May 2018 at 21:10:35 UTC, Dennis wrote:
It's unfortunate that Phobos tells you 'there's problems with the encoding' without providing any means to fix it or even diagnose it.
I have to take that back since I found out about std.encoding which has functions like `sanitize`, but also `transcode`. (My file turned out to actually be encoded with ANSI / Windows-1252, not UTF-8) Documentation is scarce however, and it requires strings instead of forward ranges.
@Jon Degenhardt
Instead of: auto outputFile = new File("output.txt"); try: auto outputFile = File("output.txt", "w");
Wow I really butchered that code. So it is the `drop(4)` that triggers the UTFException? I find Exceptions in range code hard to interpret.
@Kagamin
Do it old school?
I want to be convinved that Range programming works like a charm, but the procedural approaches remain more flexible (and faster too) it seems. Thanks for the example.