---
title: textEncodingName
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlresponse/textencodingname
---

# textEncodingName

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

## Declaration

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

## Discussion

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 CFStringConvertIANACharSetNameToEncoding(_:). You can subsequently convert that value to an NSStringEncoding value by calling CFStringConvertEncodingToNSStringEncoding(_:).

## See Also

### Getting the response properties

- [expectedContentLength](foundation/urlresponse/expectedcontentlength.md)
- [suggestedFilename](foundation/urlresponse/suggestedfilename.md)
- [mimeType](foundation/urlresponse/mimetype.md)
- [url](foundation/urlresponse/url.md)
