std.json

Rob T alanb at ucora.com
Thu Nov 14 17:36:43 PST 2013


On Wednesday, 4 July 2012 at 16:55:19 UTC, Ali Çehreli wrote:
> On 07/04/2012 08:25 AM, Alexsej wrote:
> > On Monday, 26 March 2012 at 07:14:50 UTC, Ali Çehreli wrote:
>
> >> // Assumes UTF-8 file
> >> auto content = to!string(read("json_file"));
>
> > Your example only works if the json file in UTF-8 (BOM), how
> to make
> > sure that it worked with the files in UTF-8 without BOM.
>
> I am pretty sure that I have tested it without BOM, which is 
> not recommended nor needed for UTF-8 anyway.
>
> If anything, the file should not have any BOM because it is 
> being converted to a string and is being passed to parseJSON(). 
> I don't think parseJSON() expects a BOM either. Does it?
>
> Ali

Last time I checked, parseJSON will fail if a BOM exists. Now 
that I think of it, maybe that state of affairs should be filed 
as a bug or feature enhancement.

--rt


More information about the Digitalmars-d-learn mailing list