[deserialize] Unicode escape "\u0000" is silently ignored
Created by: bupjae
ArduinoJson version: v6.18.3 Target platform: x86-64 Toolchain: gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Code snippet:
#include <iostream>
#include <string>
#include "ArduinoJson-v6.18.3.hpp"
using namespace std;
using namespace ArduinoJson;
int main() {
StaticJsonDocument<1024> doc;
cout << deserializeJson(doc, R"({"data": "wx\u0000yz"})") << endl;
string value = doc["data"];
cout << value << endl;
cout << value.length() << endl;
}
Excepted result (NUL character is replaced to '_' for visibility):
Ok
wx_yz
5
Actual result:
Ok
wxyz
4
I understand that NUL character inside string is very hard to handle for C/C++ code. However, I think this behavior should be documented at least.