Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A ArduinoJson
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Benoît Blanchon
  • ArduinoJson
  • Issues
  • #1646
Closed
Open
Issue created Aug 31, 2021 by Administrator@rootContributor

[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.

Assignee
Assign to
Time tracking