Skip to content

JSON::Object stringify unicode to UTF8 format but parser can not handle it #4704

@Lloyd-Pottiger

Description

@Lloyd-Pottiger

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior. If feasible, please provide a SSCCE - usually, it will make the process much easier and faster.

TEST(JSONParser, TestUnicode)
try
{
    String json_str = R"json({"default":"\u0050\u0050"})json";
    Poco::JSON::Parser parser;
    Poco::Dynamic::Var result = parser.parse(json_str);
    const auto & obj = result.extract<Poco::JSON::Object::Ptr>();
    auto default_val = obj->get("default");
    Poco::JSON::Object::Ptr json = new Poco::JSON::Object();
    json->set("default", default_val);
    std::stringstream ss;
    json->stringify(ss);
    std::cout << ss.str() << std::endl;
    ASSERT_TRUE(ss.str() == json_str);
}
CATCH

Expected behavior
A clear and concise description of what you expected to happen.

Logs
If applicable, add logs to help explain your problem.

Screenshots
If applicable, add screenshots to help explain your problem.

Please add relevant environment information:

  • OS Type and Version
  • POCO Version
  • Third-party product (eg. database or library) type and version

Additional context
Add any other context about the problem here.

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