---
title: "CFStringGetSmallestEncoding(_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfstringgetsmallestencoding(_:)"
---

# CFStringGetSmallestEncoding(_:)

Returns the smallest encoding on the current system for the character contents of a string.

## Declaration

```swift
func CFStringGetSmallestEncoding(_ theString: CFString!) -> CFStringEncoding
```

## Parameters

- `theString`: The string for which to find the smallest encoding.

## Return Value

Return Value The string encoding that has the smallest representation of theString.

## Discussion

Discussion This function returns the supported encoding that requires the least space (in terms of bytes needed to represent one character) to represent the character contents of a string. This information is not always immediately available, so this function might need to compute it.

## See Also

### Working With Encodings

- [CFStringConvertEncodingToIANACharSetName(_:)](corefoundation/cfstringconvertencodingtoianacharsetname(_:).md)
- [CFStringConvertEncodingToNSStringEncoding(_:)](corefoundation/cfstringconvertencodingtonsstringencoding(_:).md)
- [CFStringConvertEncodingToWindowsCodepage(_:)](corefoundation/cfstringconvertencodingtowindowscodepage(_:).md)
- [CFStringConvertIANACharSetNameToEncoding(_:)](corefoundation/cfstringconvertianacharsetnametoencoding(_:).md)
- [CFStringConvertNSStringEncodingToEncoding(_:)](corefoundation/cfstringconvertnsstringencodingtoencoding(_:).md)
- [CFStringConvertWindowsCodepageToEncoding(_:)](corefoundation/cfstringconvertwindowscodepagetoencoding(_:).md)
- [CFStringGetFastestEncoding(_:)](corefoundation/cfstringgetfastestencoding(_:).md)
- [CFStringGetListOfAvailableEncodings()](corefoundation/cfstringgetlistofavailableencodings().md)
- [CFStringGetMaximumSizeForEncoding(_:_:)](corefoundation/cfstringgetmaximumsizeforencoding(_:_:).md)
- [CFStringGetMostCompatibleMacStringEncoding(_:)](corefoundation/cfstringgetmostcompatiblemacstringencoding(_:).md)
- [CFStringGetNameOfEncoding(_:)](corefoundation/cfstringgetnameofencoding(_:).md)
- [CFStringGetSystemEncoding()](corefoundation/cfstringgetsystemencoding().md)
- [CFStringIsEncodingAvailable(_:)](corefoundation/cfstringisencodingavailable(_:).md)
