Re: [go-nuts] Ignoring UTF-8 BOM when decoding JSON

2016-09-23 Thread Jesse McNelis
On Fri, Sep 23, 2016 at 9:37 PM, Mark Richman wrote: > > Is there any way to tell Decode() to ignore the BOM, or do I have to peek at > the first 3 bytes and skip them somehow? > What you need is an io.Reader that skips the BOM. Luckily someone wrote a package for that. https://github.com/spkg/bo

[go-nuts] Ignoring UTF-8 BOM when decoding JSON

2016-09-23 Thread Mark Richman
I have a JSON file which begins with the UTF-8 byte-order marker (BOM) 0xEF 0xBB 0xBF. This causes Decode() to fail with SyntaxError: SyntaxError invalid character 'ï' looking for beginning of value - Offset: 1 Is there any way to tell Decode() to ignore the BOM, or do I have to peek at the f