Skip to content

UTF8 byte order marker breaks jsoncpp #1141

Closed
@psifertex

Description

@psifertex

Describe the bug
The documentation says that jsoncpp supports valid UTF-8. Unfortunately the optional Byte Order Mark allowed by the spec causes jsoncpp to fail to parse otherwise valid utf8.

To Reproduce

  1. Build example readFromStream.cpp
  2. Validate it works on included withComment.json via: ./readFromStream withComment.json
  3. Create a new file: (echo -en '\xef\xbb\xbf'; cat withComment.json) > withBom.json
  4. Run: ./readFromStream withBom.json

Expected behavior
The same output on step 4 and step 2. Instead, you get:

* Line 1, Column 1
  Syntax error: value, object or array expected.

Desktop (please complete the following information):

  • MacOS
  • (brew installed jsoncpp)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions