-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
jsoncons::semantic_tag::uri incorrectly encoded #238
Comments
Thanks for reporting. Yes, it's a bug with encoding text strings with semantic tags uri, base64 and base64url into CBOR tags. Fixed on master. Now we have, std::vector<uint8_t> odata;
jsoncons::ojson oj(jsoncons::json_object_arg);
oj.try_emplace("timestamp", "05-12-2020", jsoncons::semantic_tag::datetime);
oj.try_emplace("URL", "http://www.domain.com", jsoncons::semantic_tag::uri);
jsoncons::cbor::encode_cbor(oj, odata);
jsoncons::ojson oj2 = jsoncons::cbor::decode_cbor<jsoncons::ojson>(odata);
std::cout << "(oj)\n" << pretty_print(oj2) << "\n\n";
std::cout << oj2["timestamp"].as<std::string>() << ", " << oj2["timestamp"].tag() << "\n";
std::cout << oj2["URL"].as<std::string>() << ", " << oj2["URL"].tag() << "\n"; Output:
|
Wonderful - thanks for the fast action. Checking it out now. and somehow missed |
Fix verified - please consider this closed from my perspective. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code:
produces the following (incorrect) output:
I have also verified that the encoder is the problem by taking the binary output and putting it into (http://cbor.me) and receiving the same -1 result.
The text was updated successfully, but these errors were encountered: