-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: V4.01_OS
-
Fix Version/s: V4.01_ERRATA01
-
Component/s: JSON Format
-
Labels:None
-
Environment:
Closed as applied 2023-10-25.
-
Proposal:
-
Resolution:
OData 4.01 JSON Format Section 19.1 Batch Request states:
... "For media types of top-level type text, for example text/plain, the value of body is a string containing the value of the request body."
This is fine if there is an explicit charset=utf-8 parameter in the Content-Type, otherwise is highly problematic for two reasons:
1. See https://www.w3.org/International/articles/http-charset/index "It is very important to always label Web documents explicitly. HTTP 1.1 says that the default charset is ISO-8859-1. But there are too many unlabeled documents in other encodings, so browsers use the reader's preferred encoding when there is no explicit charset parameter."
With no explicit charset, we may assume that media/stream content is utf-8 when it isn't, and risk transmitting invalid UTF-8 sequences or failing conversions.
2. If charset is not us-ascii (a strict subset of utf-8) or utf-8, then the agent (client or server) attempting to encode a body as a JSON string may be unable (or even likely) to fail the conversion as it may not have a suitable conversion library for arbitrary charset conversion.
Contrast with multipart batches, where media/stream content (within a batch request/response) would be treated as binary with no conversion. If we cannot reliably use JSON batches for arbitrary "text" media/stream types without fear of conversion error or lossy conversion, then we will need to use multipart batches for reliable media/stream batch processing.