Returns the Core Foundation encoding constant that is the closest mapping to a given Cocoa encoding.
SDKs
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Core Foundation
Declaration
CFString Encoding CFStringConvertNSStringEncodingToEncoding(unsigned long encoding);
Parameters
encoding
The Cocoa string encoding (of type
NSString
) to use.Encoding
Return Value
The Core Foundation string encoding that is closest to the Cocoa string encoding encoding
. Returns the k
constant if the mapping is not known.
Discussion
The CFString
function is complementary to this function.