Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Deprecate the unused stringEncoding property of AFHTTPResponseSerializer #3751

Merged
merged 1 commit into from Oct 14, 2016

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Oct 13, 2016

The stringEncoding property is never used. It was probably inroduced by error in 9a40c0d. It was probably a copy/paste error as the same property also exists on AFHTTPRequestSerializer where it’s actually used.

The `stringEncoding` property is never used. It was probably inroduced by error in 9a40c0d. It was probably a copy/paste error as the same property also exists on `AFHTTPRequestSerializer` where it’s actually used.
@skyline75489
Copy link
Contributor

Is this sort of breaking backward compatibility ? If stick strictly to semver, this should probably be in 4.0.0.

@0xced
Copy link
Contributor Author

0xced commented Oct 14, 2016

I just marked the property as deprecated, so this is not breaking backward compatibility. Removing it would break compatibility and warrant a 4.0.0 version.

But even when introducing breaking changes, it’s always a good idea to deprecate and explain with a comment what the replacement is.

@skyline75489
Copy link
Contributor

skyline75489 commented Oct 14, 2016

Got it. Thanks for the explaination.

@0xced 0xced changed the title Deprecate AFHTTPResponseSerializer.stringEncoding Deprecate the unused stringEncoding property of AFHTTPResponseSerializer Oct 14, 2016
@0xced 0xced merged commit 4f3c694 into AFNetworking:master Oct 14, 2016
@0xced 0xced deleted the deprecate-stringEncoding branch October 14, 2016 12:26
@tcamin
Copy link

tcamin commented Feb 2, 2018

This looks like a major breaking change.

Before these changes the value of the property was set to NSUTF8StringEncoding = 4 in AFURLResponseSerialization's initializer, now it's defaulted to 0 which is actually an invalid string encoding.

If you try to encode/decode using 0 (e.g. [@"test" dataUsingEncoding:0]) you'll be prompted with the following warning:
Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatibility mapping behavior in the near future. 

So in the new implementation stringEncoding will be actually NSASCIIStringEncoding and not NSUTF8StringEncoding as it was before.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants