This repository contains some documentations and implementations for Pitch(Foundation): String Encoding Names.
This repository is also a Swift package1, accordingly you can try it out easily:
// Package.swift
let package = Package(
...
dependencies: [
.package(url: "https://github.com/YOCKOW/SF-StringEncodingNameImpl.git", from: "0.2.1"),
],
...
)
// YourProjectSource.swift
import StringEncodingNameImpl
// Based on IANA registry
print(String.Encoding.utf8.name(.iana)!) // Prints "UTF-8"
print(String.Encoding(iana: "ISO_646.irv:1991") == .ascii) // Prints "true"
// Based on WHATWG Living Standard
print(String.Encoding.macOSRoman.name(.whatwg)!) // Prints "macintosh"
print(String.Encoding(whatwg: "us-ascii") == .windowsCP1252) // Prints "true"
-
This package depends on other packages which are required for the code generator.
StringEncodingNameImpl
itself has no dependencies. ↩