Skip to content

Conversation

YOCKOW
Copy link
Member

@YOCKOW YOCKOW commented Apr 8, 2025

This proposal allows String.Encoding to be converted to and from various names.

For example:

print(String.Encoding.utf8.ianaName!) // Prints "UTF-8"
print(String.Encoding(ianaName: "ISO_646.irv:1991") == .ascii) // Prints "true"

Implementation: #1286

@YOCKOW YOCKOW requested a review from itingliu April 8, 2025 06:50
@YOCKOW YOCKOW added the proposal This PR is for a proposal label Apr 8, 2025
@YOCKOW YOCKOW force-pushed the StringEncodingNames/proposal branch from fe0e03c to 723256c Compare April 18, 2025 05:29
@YOCKOW YOCKOW force-pushed the StringEncodingNames/proposal branch from 723256c to 3a22a12 Compare May 9, 2025 07:40
@YOCKOW YOCKOW force-pushed the StringEncodingNames/proposal branch from 3a22a12 to ce849f7 Compare June 17, 2025 01:13
YOCKOW added 4 commits August 18, 2025 11:43
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"
```
@YOCKOW YOCKOW force-pushed the StringEncodingNames/proposal branch from ce849f7 to 171d501 Compare August 18, 2025 03:17
@YOCKOW
Copy link
Member Author

YOCKOW commented Aug 18, 2025

@itingliu

I think #1029 implies legacy encodings are still necessary in some areas.
While this proposed feature doesn't support some legacy encodings, this feature will make it easy to implement more string conversions since we already have the string converter that wraps ICU APIs and that requires IANA Charset Names to create an instance of naive ICU converter.

I mean I believe this feature is useful not only as public properties but also for internal use.
I hope this proposal will come up to the official process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal This PR is for a proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant