Skip to content

SR-7620: Use charset encoding if available for NSString(contentsOf:usedEncoding:) #1565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2018

Conversation

spevans
Copy link
Contributor

@spevans spevans commented May 27, 2018

NSString(contentsOf:usedEncoding:) would only test for UTF16 and UTF32 before falling back to UTF8. Using the char-set from the Content-Type header if available allows the specified encoding to be tried.

This matches the behaviour on Darwin for non-file URLs.

@spevans
Copy link
Contributor Author

spevans commented May 27, 2018

@swift-ci please test

Copy link
Contributor

@parkera parkera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@spevans
Copy link
Contributor Author

spevans commented May 29, 2018

@swift-ci please test and merge

@swift-ci swift-ci merged commit 9ecb4fa into swiftlang:master May 29, 2018
@sergeydi
Copy link

sergeydi commented Jun 7, 2018

Hi,
In what release this fix will be?

@parkera
Copy link
Contributor

parkera commented Jun 14, 2018

This looks lined up for Swift 5.0. We'll need to cherry-pick to the swift-4.2-branch to make sure it lands there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants