Skip to content

Regression: isAnyCharRequiredQuoting() is broken on Windows in JsonCpp 1.9.3 for some locales. #1187

Closed
@TheStormN

Description

@TheStormN

Describe the bug
The tab character is not escaped on Windows with various locales. This bug is a regression in 1.9.3, it is not present in 1.9.2.

To Reproduce
Steps to reproduce the behavior:

setlocale(LC_ALL, "English_United States.1252");

Json::Value result(Json::objectValue);
result["test"] = "\tTest123";

Json::StreamWriterBuilder builder;
assert(Json::writeString(builder, result) == "{\"test\":\"\\tTest123\"}" );

Expected behavior
The tab character should be escaped.

Desktop:

  • OS: Windows 10 1909
  • Meson version - Using Conan
  • Ninja version - Using Conan

Additional context
isAnyCharRequiredQuoting() uses std::isprint() which gives different results on Windows. The version of that function in 1.9.2 was working properly. Perhaps you can just revert it?

Update: It seems that the locale does not matter, to reproduce the bug you only need to have \t as a special character among the normal string.

Update 2: It seems that the locale does matter. Had to restart the PC to get proper results after changing the locale several times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions