Open lindycoder opened 3 months ago
Moving this to jiter.
We need to check what serde-json does.
Serde fails with the same error message:
Part of the problem will be that a Python str
is allowed to have invalid unicode sequences (see e.g. PEP 383 and the 'surrogateescape' handler) to contain (encoded) arbitrary byte payloads. Decoding to UTF8 (and any UTF8 operations) on these strings will fail.
Rust String
data, on the other hand, strictly requires valid UTF8.
Hello,
In out migration to pydantic 2, we found a JSON document that pydantic 1 was able to load and pydantic 2 can't with the error:
Here's a simple way of reproducing:
This first print from python's json works:
The second one using pydantic_core (used by pydantic2) raises
Here's some versions
Thank you!