Returns the C-string encoding assumed for any method accepting a C string as an argument.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
The C-string encoding assumed for any method accepting a C string as an argument.
This method returns a user-dependent encoding who value is derived from user's default language and potentially other factors. You might sometimes need to use this encoding when interpreting user documents with unknown encodings, in the absence of other hints, but in general this encoding should be used rarely, if at all. Note that some potential values might result in unexpected encoding conversions of even fairly straightforward
NSString content—for example, punctuation characters with a bidirectional encoding.
Methods that accept a C string as an argument use
...CString... in the keywords for such arguments: for example,
stringWithCString:—note, though, that these are deprecated. The default C-string encoding is determined from system information and can’t be changed programmatically for an individual process. See
NSStringEncoding for a full list of supported encodings.
Working with Encodings
Returns a zero-terminated list of the encodings string objects support in the application’s environment.
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