Returns the string encoding for the given data as detected by attempting to create a string according to the specified encoding options.
- iOS 8.0+
- macOS 10.10+
- tvOS 9.0+
- watchOS 2.0+
- Mac Catalyst 13.0+Beta
NSData object containing bytes in an encoding to be determined.
Options to use when attempting to determine the string encoding. See String Encoding Detection Options for a full list of supported options.
If a string encoding could be determined, upon return contains an
NSString object constructed from data using the determined string encoding.
If a string encoding could be determined, upon return contains a
BOOL value corresponding to whether lossy conversion was used.
NSStringEncoding value, or
0 if a string encoding could not be determined.
Working with Encodings
Returns a zero-terminated list of the encodings string objects support in the application’s environment.
Returns the C-string encoding assumed for any method accepting a C string as an argument.
Returns a Boolean value that indicates whether the receiver can be converted to a given encoding without loss of information.
NSData object containing a representation of the receiver encoded using a given encoding.
The fastest encoding to which the receiver may be converted without loss of information.
The smallest encoding to which the receiver can be converted without loss of information.
The following constants are provided by
NSString as possible string encodings.
NSString Handling Exception Names
These constants define the names of exceptions raised if
NSString cannot represent a string in a given encoding, or parse a string as a property list.
This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.Learn more about using Apple's beta software