-
Notifications
You must be signed in to change notification settings - Fork 159
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
Cannot instantiate String with Data with encoding nonLossyASCII #929
Comments
I've merged the fix to |
@jmschonfeld I don’t think that’s true: print(String(data: Data("yolo\\012".utf8), encoding: .nonLossyASCII))
print(String(data: Data("yolo\\012".utf8), encoding: .ascii)) First version prints |
@Frizlab which macOS version are you testing this on? There were some slight behavioral updates to this function in macOS 15 when the function was re-implemented in Swift rather than bridging to |
Also on macOS 14.7 w/ Xcode 15.2. 12 in octal is a newline in ascii. Interestingly, |
The following code returns
nil
with Swift 6.0 and Swift 6.0-snapshot-2024-09-17 on Linux, but returns the proper String on macOS:String(data: Data(#"yolo"#.utf8), encoding: .nonLossyASCII)
.I believe macOS is in the right.
The text was updated successfully, but these errors were encountered: