Contents

characterEncoding

The string encoding for the document.

Declaration

static let characterEncoding: NSAttributedString.DocumentAttributeKey

Discussion

The value of this attribute is an NSNumber object containing integer specifying NSStringEncoding for the file; default for plain text is the default encoding. This key in options can specify the string encoding for reading the data. Upon return, the document attributes can contain the actual encoding used. For writing methods, this value is used for generating the plain text data.

The string constant in macOS 10.3 and earlier is @"CharacterEncoding".

See Also

Getting document metadata keys