https://issues.dlang.org/show_bug.cgi?id=15949
--- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/5d52a81e4dede77fe75eb3215f1b24b898963f26 Fix issue 15949: Make readText check BOMs. This makes it so that readText checks for a BOM. If there is a BOM, it is for UTF-8, UTF-16, or UTF-32, and it doesn't match the requested string type, then a UTFException is thrown. Other encodings are let through in case they happen to work with the requested string type and pass UTF validation. Also, this makes it so that readText checks the alignment of the buffer against the requested string type and throws a UTFException instead of letting the cast throw an Error. https://github.com/dlang/phobos/commit/d43925ec6048f49b56c9f4b0cc22ed07999f63a1 Merge pull request #6113 from jmdavis/issue15949 Fix issue 15949: Make readText check BOMs. merged-on-behalf-of: Vladimir Panteleev <git...@thecybershadow.net> --