You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just tested this with swift-DEVELOPMENT-SNAPSHOT-2018-05-26-a on Ubuntu 16.04 and it works fine. Note that https://www.google.com is actually served with charset=ISO-8859-1 and it does contain non-ASCII bytes in the data.
However String(contentsOf: url) doesnt work because it tries to determine the encoding by looking for a BOM (Byte Order Mark) in the first few bytes for UTF-16/UTF-32, falling back to UTF-8.
This page won't decode as UTF-8, which is correct, so I have written a PR that fixes NSString(contentsOf:usedEncoding: )
(the underlying call) to use the Content-Type header if available to find the encoding to use.
Environment
Ubuntu 16.04(with last updates), Swift 4.1.1
Additional Detail from JIRA
md5: 3d20f9724259d3d924f97a21c1420271
Issue Description:
The following code:
On swift3 returns google page. On Swift 4 returns:
The text was updated successfully, but these errors were encountered: