UTF-8 requested. BOM is for UTF-16

Gregor Mückl gregormueckl at gmx.de
Mon Sep 16 19:27:52 UTC 2019

On Sunday, 15 September 2019 at 23:50:27 UTC, solidstate1991 
> This is what I get when I try to run a unittest on one of my 
> projects.
> Here's the file that generates this error: 
> https://github.com/ZILtoid1991/pixelperfectengine/blob/master/pixelperfectengine/src/PixelPerfectEngine/graphics/extensions.d

Since the Unicode BOM is a set of code points like any other, 
they can be expressed in UTF-8. There are the occasional text 
files that have a BOM even though they are encoded as UTF-8. I 
feel that readText is too strict in that case. It should just 
silently ignore the BOM and continue because it is just 
meaningless. Throwing an exception seems completely wrong to me.

More information about the Digitalmars-d mailing list