Swiftpack.co - Package - TheAngryDarling/StringIANACharacterSetEncoding

String IANA Character Set Encoding

macOS Linux Apache 2

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

On the Mac platforms this package uses the CFStringConvertIANACharSetNameToEncoding and CFStringConvertEncodingToNSStringEncoding methods.
On other platforms this packages uses a static dictionary of names to encoding values

Usage

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

_ = encoding.charSetName
_ = encoding.noDashCharSetName

Author

License

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

Acknowledgments

Stack Overflow resposne from rmaddy

Github

link
Stars: 0
Help us keep the lights on

Dependencies

Used By

Total: 0