<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextEncodingNameDocumentAttribute",
  "metadataVersion" : "0.1.0",
  "role" : "Global Variable",
  "symbol" : {
    "kind" : "Global Variable",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:@NSTextEncodingNameDocumentAttribute"
  },
  "title" : "NSTextEncodingNameDocumentAttribute"
}
-->

# NSTextEncodingNameDocumentAttribute

The name of the text encoding to use.

```
extern NSAttributedStringDocumentAttributeKey NSTextEncodingNameDocumentAttribute;
```

## Discussion

An <doc://com.apple.documentation/documentation/Foundation/NSString> object containing the name, IANA or otherwise, of a text encoding to be used. This attribute is mutually exclusive with [`NSCharacterEncodingDocumentAttribute`](/documentation/AppKit/NSCharacterEncodingDocumentAttribute).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)