Enumeration

Unicode.UTF8

No overview available.

Declaration

@frozen enum UTF8

Topics

Type Aliases

typealias Unicode.UTF8.CodeUnit

The basic unit of encoding

typealias Unicode.UTF8.EncodedScalar

A valid scalar value as represented in this encoding

Initializers

init()

Creates an instance of the UTF-8 codec.

Type Properties

static var encodedReplacementCharacter: Unicode.UTF8.EncodedScalar

A unicode scalar value to be used when repairing encoding/decoding errors, as represented in this encoding.

Instance Methods

func decode<I>(inout I) -> UnicodeDecodingResult

Starts or continues decoding a UTF-8 sequence.

Type Methods

static func decode(Unicode.UTF8.EncodedScalar) -> Unicode.Scalar

Converts from encoded to encoding-independent representation

static func encode(Unicode.Scalar) -> Unicode.UTF8.EncodedScalar?

Converts from encoding-independent to encoded representation, returning nil if the scalar can’t be represented in this encoding.

static func encode(Unicode.Scalar, into: (Unicode.UTF8.CodeUnit) -> Void)

Encodes a Unicode scalar as a series of code units by calling the given closure on each code unit.

static func isASCII(Unicode.UTF8.CodeUnit) -> Bool

Returns whether the given code unit represents an ASCII scalar

static func isContinuation(Unicode.UTF8.CodeUnit) -> Bool

Returns a Boolean value indicating whether the specified code unit is a UTF-8 continuation byte.

static func transcode<FromEncoding>(FromEncoding.EncodedScalar, from: FromEncoding.Type) -> Unicode.UTF8.EncodedScalar?

Converts a scalar from another encoding’s representation, returning nil if the scalar can’t be represented in this encoding.

static func transcode<FromEncoding>(FromEncoding.EncodedScalar, from: FromEncoding.Type) -> _ValidUTF8Buffer?

Converts a scalar from another encoding’s representation, returning nil if the scalar can’t be represented in this encoding.

static func width(Unicode.Scalar) -> Int

Returns the number of code units required to encode the given Unicode scalar.

Structures

struct Unicode.UTF8.ForwardParser

A type that can be used to parse CodeUnits into EncodedScalars.

struct Unicode.UTF8.ReverseParser

A type that can be used to parse a reversed sequence of CodeUnits into EncodedScalars.

Relationships

Conforms To

See Also

Unicode Codecs

protocol UnicodeCodec

A Unicode encoding form that translates between Unicode scalar values and form-specific code units.

enum UnicodeDecodingResult

The result of one Unicode decoding step.

enum Unicode.ParseResult

The result of attempting to parse a T from some input.