Type Alias

NSStringEncoding

The following constants are provided by NSString as possible string encodings.

Declaration

typedef NSUInteger NSStringEncoding;

Discussion

These values represent the various character encodings supported by the NSString classes. This is an incomplete list. Additional encodings are defined in String Programming Guide for Core Foundation (see CFStringEncodingExt.h); these encodings can be used with NSString by first passing the Core Foundation encoding to the CFStringConvertEncodingToNSStringEncoding function.

Topics

Constants

NSASCIIStringEncoding

Strict 7-bit ASCII encoding within 8-bit chars; ASCII values 0…127 only.

NSNEXTSTEPStringEncoding

8-bit ASCII encoding with NEXTSTEP extensions.

NSJapaneseEUCStringEncoding

8-bit EUC encoding for Japanese text.

NSUTF8StringEncoding

An 8-bit representation of Unicode characters, suitable for transmission or storage by ASCII-based systems.

NSISOLatin1StringEncoding

8-bit ISO Latin 1 encoding.

NSSymbolStringEncoding

8-bit Adobe Symbol encoding vector.

NSNonLossyASCIIStringEncoding

7-bit verbose ASCII to represent all Unicode characters.

NSShiftJISStringEncoding

8-bit Shift-JIS encoding for Japanese text.

NSISOLatin2StringEncoding

8-bit ISO Latin 2 encoding.

NSUnicodeStringEncoding

The canonical Unicode encoding for string objects.

NSWindowsCP1251StringEncoding

Microsoft Windows codepage 1251, encoding Cyrillic characters; equivalent to AdobeStandardCyrillic font encoding.

NSWindowsCP1252StringEncoding

Microsoft Windows codepage 1252; equivalent to WinLatin1.

NSWindowsCP1253StringEncoding

Microsoft Windows codepage 1253, encoding Greek characters.

NSWindowsCP1254StringEncoding

Microsoft Windows codepage 1254, encoding Turkish characters.

NSWindowsCP1250StringEncoding

Microsoft Windows codepage 1250; equivalent to WinLatin2.

NSISO2022JPStringEncoding

ISO 2022 Japanese encoding for email.

NSMacOSRomanStringEncoding

Classic Macintosh Roman encoding.

NSUTF16BigEndianStringEncoding

NSUTF16StringEncoding encoding with explicit endianness specified.

NSUTF16LittleEndianStringEncoding

NSUTF16StringEncoding encoding with explicit endianness specified.

NSUTF32StringEncoding

32-bit UTF encoding.

NSUTF32BigEndianStringEncoding

NSUTF32StringEncoding encoding with explicit endianness specified.

NSUTF32LittleEndianStringEncoding

NSUTF32StringEncoding encoding with explicit endianness specified.

NSProprietaryStringEncoding

Installation-specific encoding.

See Also

Working with Encodings

availableStringEncodings

Returns a zero-terminated list of the encodings string objects support in the application’s environment.

defaultCStringEncoding

Returns the C-string encoding assumed for any method accepting a C string as an argument.

stringEncodingForData:encodingOptions:convertedString:usedLossyConversion:

Returns the string encoding for the given data as detected by attempting to create a string according to the specified encoding options.

localizedNameOfStringEncoding:

Returns a human-readable string giving the name of a given encoding.

canBeConvertedToEncoding:

Returns a Boolean value that indicates whether the receiver can be converted to a given encoding without loss of information.

dataUsingEncoding:

Returns an NSData object containing a representation of the receiver encoded using a given encoding.

dataUsingEncoding:allowLossyConversion:

Returns an NSData object containing a representation of the receiver encoded using a given encoding.

description

This NSString object.

fastestEncoding

The fastest encoding to which the receiver may be converted without loss of information.

smallestEncoding

The smallest encoding to which the receiver can be converted without loss of information.

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.