We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)
Target: x86_64-apple-darwin18.6.0
macOS 10.14.5 / Xcode 10.2.1 (10E1001)
md5: bc2f601a88bc080ddf2da69443eeb674
Issue Description:
Since Swift 5, and also on Swift 5.1, bridging a short string from Swift.String to NSString drops U+FEFF character at the beginning.
let bom = "\u{FEFF}" // U+FEFF (ZERO WIDTH NO-BREAK SPACE) bom.count // -> 1 "\(bom)abc".count // -> 4 NSString(string: bom).length // -> 0 (correct: 1) NSString(string: "\(bom)abc").length // -> 3 (correct: 4) NSString(string: "\(bom)\(bom)abc").length // -> 4 (correct: 5) NSString(string: "a\(bom)bc").length // -> 4 NSString(string: "\(bom)234567890123").length // -> 12 (correct: 13) NSString(string: "\(bom)2345678901234").length // -> 14
This issue arises also when the string was bridged to NSString implicitly.
let string = "\(bom)abc" let middleIndex = string.index(string.startIndex, offsetBy: 2) string.enumerateSubstrings(in: middleIndex..<string.endIndex, options: .byLines) { (_, _, _, _) in } // <- crash
CC: @milseman This is about the issue I told you in the Swift lab at WWDC.
The text was updated successfully, but these errors were encountered:
CC @Catfish-Man, who was looking at a fix to a related issue
Sorry, something went wrong.
Half-fixed in apple/swift#25957
It now works correctly with "… as NSString", but remains incorrect with "NSString(string: …)"
Catfish-Man
No branches or pull requests
Environment
Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)
Target: x86_64-apple-darwin18.6.0
macOS 10.14.5 / Xcode 10.2.1 (10E1001)
Additional Detail from JIRA
md5: bc2f601a88bc080ddf2da69443eeb674
Issue Description:
Since Swift 5, and also on Swift 5.1, bridging a short string from Swift.String to NSString drops U+FEFF character at the beginning.
This issue arises also when the string was bridged to NSString implicitly.
CC: @milseman This is about the issue I told you in the Swift lab at WWDC.
The text was updated successfully, but these errors were encountered: