<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLResponse/textEncodingName",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLResponse(py)textEncodingName"
  },
  "title" : "textEncodingName"
}
-->

# textEncodingName

The name of the text encoding provided by the response’s originating source.

```
var textEncodingName: String? { get }
```

## Discussion

If no text encoding was provided by the protocol, this property’s value is `nil`.

You can convert this string to a `CFStringEncoding` value by calling <doc://com.apple.documentation/documentation/CoreFoundation/CFStringConvertIANACharSetNameToEncoding(_:)>. You can subsequently convert that value to an `NSStringEncoding` value by calling <doc://com.apple.documentation/documentation/CoreFoundation/CFStringConvertEncodingToNSStringEncoding(_:)>.

---

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)