Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BOM #92

Closed
pkoppstein opened this issue Jul 14, 2021 · 3 comments
Closed

BOM #92

pkoppstein opened this issue Jul 14, 2021 · 3 comments

Comments

@pkoppstein
Copy link

pkoppstein commented Jul 14, 2021

UTF-8 allows the BOM (byte-order mark) as does jq:

$ file bom.json
bom.json: UTF-8 Unicode (with BOM) text

$ cat bom.json | hexdump
0000000 ef bb bf 22 42 4f 4d 22 0a                     
0000009
$ jq empty bom.json

$ gojq empty bom.json
gojq: invalid json: bom.json
    "BOM"
    ^  invalid character 'ï' looking for beginning of value

There is a SO thread related to this at
https://stackoverflow.com/questions/2223882/whats-the-difference-between-utf-8-and-utf-8-without-bom

@itchyny
Copy link
Owner

itchyny commented Jul 14, 2021

golang/go#12254
BOM is dead isn't it? I don't like it, too.

@pkoppstein
Copy link
Author

FWUW, RFC7159 says:

In the interests of interoperability, implementations
that parse JSON texts MAY ignore the presence of a byte order mark
rather than treating it as an error.

@itchyny
Copy link
Owner

itchyny commented Jul 14, 2021

It says MAY. Unlikely to support, as well as Go does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants