---
title: textEncodingName
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/nsattributedstring/documentattributekey/textencodingname
---

# textEncodingName

The name of the text encoding to use.

## Declaration

```swift
static let textEncodingName: NSAttributedString.DocumentAttributeKey
```

## Discussion

Discussion An NSString object containing the name, IANA or otherwise, of a text encoding to be used. This attribute is mutually exclusive with characterEncoding.

## See Also

### Getting document type keys

- [documentType](foundation/nsattributedstring/documentattributekey/documenttype.md)
- [fileType](foundation/nsattributedstring/documentattributekey/filetype.md)
