Swiftpack.co -  TheAngryDarling/SwiftStringIANACharacterSetEncoding as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
TheAngryDarling/SwiftStringIANACharacterSetEncoding
IANA Character Set Encoding Conversion
.package(url: "https://github.com/TheAngryDarling/SwiftStringIANACharacterSetEncoding.git", from: "2.0.4")

String IANA Character Set Encoding

Swift macOS Linux Apache 2

Adds the ability of taking an IANA encoding name and converting it into a String.Encoding object.

This package uses the CFStringConvertIANACharSetNameToEncoding and CFStringConvertEncodingToNSStringEncoding methods.

Usage

let ianaEncodingName: String = "UTF8"
guard let encoding = String(IANACharSetName: ianaEncodingName) else { 
    throw Error.InvalidEncoding(ianaEncodingName)
}

_ = encoding.IANACharSetName
_ = encoding.noDashIANACharSetName

Author

License

This project is licensed under Apache License v2.0 - see the LICENSE.md file for details

Acknowledgments

Stack Overflow resposne from rmaddy Patch for swift retain on swift versions 4.0, 4.1 provided on Swift Bugs by Knock YOCKOW

GitHub

link
Stars: 0
Last commit: 2 years ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API