Skip to content

Commit 27effcb

Browse files
authored
SF-0033: Amend proposal in response to feedback. (#1502)
* [Proposal] Add "String Encoding Names" proposal. This proposal allows `String.Encoding` to be converted to and from various names. For example: ```swift print(String.Encoding.utf8.ianaName!) // Prints "UTF-8" print(String.Encoding(ianaName: "ISO_646.irv:1991") == .ascii) // Prints "true" ``` * Change the link to implementation. * Remove description about #1015 since it is resolved. Links: - Issue: #1015 - Resolvers: * #1217 * swiftlang/swift-corelibs-foundation#5194 * Add a description about already-available ICU string converter. * SF-0033: Add `@available` attributes to sample code. In response to: https://forums.swift.org/t/review-sf-0033-string-encoding-names/81965/7 * SF-0033: Clarify which "case-insensitivity" is used. In response to: https://forums.swift.org/t/review-sf-0033-string-encoding-names/81965/8 * SF-0033: Change FoundationPreview version to 6.3. In response to: #1502 (comment)
1 parent 02c0494 commit 27effcb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Proposals/0033-String-Encoding-Names.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,11 @@ We introduce a computed property that returns the name, and the initializer that
159159
```swift
160160
extension String.Encoding {
161161
/// The name of this encoding that is compatible with the one of the IANA registry "charset".
162+
@available(FoundationPreview 6.3, *)
162163
public var ianaName: String?
163164

164165
/// Creates an instance from the name of the IANA registry "charset".
166+
@available(FoundationPreview 6.3, *)
165167
public init?(ianaName: String)
166168
}
167169
```
@@ -222,7 +224,7 @@ Accordingly, this proposal suggests just simple correspondence between `String.E
222224

223225
### Name to `String.Encoding`
224226

225-
- `init(ianaName:)` adopts case-insensitive comparison with *Preferred MIME Name*, *Name*, and *Aliases*.
227+
- `init(ianaName:)` adopts ASCII case-insensitive comparison with *Preferred MIME Name*, *Name*, and *Aliases*.
226228

227229

228230
## Source compatibility
@@ -232,7 +234,7 @@ These changes proposed here are only additive. However, care must be taken if mi
232234

233235
## Implications on adoption
234236

235-
This feature can be freely adopted and un-adopted in source code with no deployment constraints and without affecting source compatibility.
237+
This feature can be freely adopted and un-adopted in source code without affecting source compatibility.
236238

237239

238240
## Future directions

0 commit comments

Comments
 (0)