Skip to content

Commit ce8bf50

Browse files
committed
---
yaml --- r: 347637 b: refs/heads/master c: 6e4aa24 h: refs/heads/master i: 347635: 4afd435
1 parent 40dab52 commit ce8bf50

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 76e02b6b4413b47c3c60ec035727b5d50bc97651
2+
refs/heads/master: 6e4aa2491ceac93132a12ebdbc426742618bd680
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/stdlib/public/Darwin/Foundation/NSStringAPI.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,9 +800,14 @@ extension StringProtocol where Index == String.Index {
800800
using encoding: String.Encoding,
801801
allowLossyConversion: Bool = false
802802
) -> Data? {
803-
return _ns.data(
804-
using: encoding.rawValue,
805-
allowLossyConversion: allowLossyConversion)
803+
switch encoding {
804+
case .utf8:
805+
return Data(self.utf8)
806+
default:
807+
return _ns.data(
808+
using: encoding.rawValue,
809+
allowLossyConversion: allowLossyConversion)
810+
}
806811
}
807812

808813
// @property NSString* decomposedStringWithCanonicalMapping;

0 commit comments

Comments
 (0)