std.stream, BOM, and deprecation

Jonathan M Davis jmdavisProg at gmx.com
Sat Oct 13 19:10:15 PDT 2012


On Saturday, October 13, 2012 18:53:48 Charles Hixson wrote:
> If std.stream is being deprecated, what is the correct way to deal with
> file BOMs.  This is particularly concerning utf8 files, which I
> understand to be a bit problematic, as there isn't, actually, a utf8
> BOM, merely a convention which isn't a part of a standard.  But the
> std.stdio documentation doesn't so much as mention byte order marks (BOMs).
> 
> If this should wait until std.io is released, then I could use
> std.stream until them, but the documentation is already warning to avoid
> using it.

std.stream will be around until after std.io has been introduced, because 
std.io will be its replacement. As for dealing with BOMs, I don't really know 
anything about that, so I don't really have any suggestions. I know that it's 
come up before, and you can probably find some discussion on it in the 
archives, but for the most part, Phobos' I/O assumes UTF-8 or compatible, and 
if you want something else, you have to deal with it yourself. It's an area 
where Phobos needs improvement.

You can use std.stream, but just be aware that in the long term, you'll either 
have to refactor your code so that it uses another solution (presumably 
std.io) or copy std.stream to your own stuff, because it's going to be removed 
from Phobos eventually.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list