-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Clarify documentation for supported encodings in AFJSONResponseSerializer #3750
Conversation
@@ -111,6 +111,8 @@ NS_ASSUME_NONNULL_BEGIN | |||
- `application/json` | |||
- `text/json` | |||
- `text/javascript` | |||
|
|||
According to RFC 4627, JSON text should be encoded in Unicode and the default encoding is UTF-8. NSJSONSerialization also recommends using UTF-8 for efficiency, even though it actually supports more encodings. Using unsupported encoding will result in serialization error. See the `NSJSONSerialization` documentation for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to mention RFC 7159 instead of RFC 4627 which is an older version. Also, it’s not should, it’s SHALL which, according to RFC 2119 is is an absolute requirement of the specification.
@@ -111,6 +111,8 @@ NS_ASSUME_NONNULL_BEGIN | |||
- `application/json` | |||
- `text/json` | |||
- `text/javascript` | |||
|
|||
In RFC 7159 - Section 8.1, it states that JSON text is required to be encoded in UTF-8, UTF-16, or UTF-32, and the default encoding is UTF-8. NSJSONSerialization provides support for all the encodings listed in the specification, and recommends UTF-8 for efficiency. Using unsupported encoding will result in serialization error. See the `NSJSONSerialization` documentation for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo: should say “using an unsupported encoding.”
@skyline75489 Can you merge in |
Codecov Report
@@ Coverage Diff @@
## master #3750 +/- ##
======================================
Coverage 82.8% 82.8%
======================================
Files 46 46
Lines 5304 5304
Branches 439 439
======================================
Hits 4392 4392
Misses 671 671
Partials 241 241
Continue to review full report at Codecov.
|
@SlaunchaMan Done. |
This clarify the data encoding needed for
AFJSONResponseSerializer
to successfully parsing the response as JSON object.