Text Encoding Conversion Manager Reference
| Framework |
CoreServices/CoreServices.h |
| Declared in | TextCommon.h TextEncodingConverter.h TextEncodingPlugin.h UnicodeConverter.h |
Overview
The Text Encoding Conversion (TEC) Manager provides two facilities—the Text Encoding Converter and the Unicode Converter—that your application can use to handle text encoding conversion on the Mac OS. You will find the Text Encoding Conversion Manager helpful if you develop Internet applications, such as Web browsers or e-mail applications, applications that transfer text across different platforms, or applications based in Unicode.
Functions by Task
Creating a Text Encoding Specification
Obtaining Information From a Text Encoding Specification
-
GetTextEncodingBase -
GetTextEncodingFormat -
GetTextEncodingName -
GetTextEncodingVariant -
ResolveDefaultTextEncoding
Converting Between Script Manager Values and Text Encodings
Obtaining Information About Available Text Encodings
-
TECCountAvailableTextEncodings -
TECCountSubTextEncodings -
TECGetAvailableTextEncodings -
TECGetSubTextEncodings -
NearestMacTextEncodings
Identifying Direct Encoding Conversions
Identifying Possible Destination Encodings
Obtaining Converter Information
Creating and Deleting Converter Objects
Converting Text Between Encodings
Converting to Multiple Encoding Runs
-
TECConvertTextToMultipleEncodings -
TECCreateOneToManyConverter -
TECFlushMultipleEncodings -
TECGetEncodingList
Using Sniffers to Investigate Encodings
-
TECCreateSniffer -
TECClearSnifferContextInfo -
TECDisposeSniffer -
TECCountAvailableSniffers -
TECGetAvailableSniffers -
TECSniffTextEncoding
Getting Information About Internet and Regional Text Encoding Names
-
TECCountMailTextEncodings -
TECCountWebTextEncodings -
TECGetMailTextEncodings -
TECGetTextEncodingFromInternetName -
TECGetTextEncodingInternetName -
TECGetWebTextEncodings
Converting to Unicode
-
ChangeTextToUnicodeInfo -
ConvertFromTextToUnicode -
CreateTextToUnicodeInfo -
CreateTextToUnicodeInfoByEncoding -
DisposeTextToUnicodeInfo -
ResetTextToUnicodeInfo
Converting From Unicode
-
ChangeUnicodeToTextInfo -
ConvertFromUnicodeToText -
CreateUnicodeToTextInfo -
CreateUnicodeToTextInfoByEncoding -
DisposeUnicodeToTextInfo -
ResetUnicodeToTextInfo
Converting From Unicode to Multiple Encodings
-
ConvertFromUnicodeToTextRun -
ConvertFromUnicodeToScriptCodeRun -
CreateUnicodeToTextRunInfo -
CreateUnicodeToTextRunInfoByEncoding -
CreateUnicodeToTextRunInfoByScriptCode -
DisposeUnicodeToTextRunInfo -
ResetUnicodeToTextRunInfo
Converting Between Unicode and Pascal Strings
Obtaining Unicode Mapping Information
Truncating Strings Before Converting Them
Setting the Fallback Handler
Working With Universal Procedure Pointers
Getting UniChar Property Values
Functions
ChangeTextToUnicodeInfo
Changes the mapping information for the specified Unicode converter object used to convert text to Unicode to the new mapping you provide.
OSStatus ChangeTextToUnicodeInfo ( TextToUnicodeInfo ioTextToUnicodeInfo, ConstUnicodeMappingPtr iUnicodeMapping );
Parameters
- ioTextToUnicodeInfo
The Unicode converter object of type
TextToUnicodeInfocontaining the mapping to be modified. You use the functionCreateTextToUnicodeInfoto obtain one.- iUnicodeMapping
A structure of type
UnicodeMappingidentifying the new mapping to be used. This is the mapping that replaces the existing mapping in the Unicode converter object.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
The function replaces the mapping table information that currently
exists in the Unicode converter object pointed to by the ioTextToUnicodeInfo parameter
with the information contained in the UnicodeMapping structure
you supply as the iUnicodeMapping parameter.
ChangeTextToUnicodeInfo resets
the Unicode converter object’s fields as necessary.
If an error is returned, the Unicode converter object is invalid.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hChangeUnicodeToTextInfo
Changes the mapping information contained in the specified Unicode converter object used to convert Unicode text to a non-Unicode encoding.
OSStatus ChangeUnicodeToTextInfo ( UnicodeToTextInfo ioUnicodeToTextInfo, ConstUnicodeMappingPtr iUnicodeMapping );
Parameters
- ioUnicodeToTextInfo
The Unicode converter object of type
UnicodeToTextInfoto be modified. You use the functionCreateUnicodeToTextInfoorCreateUnicodeToTextInfoByEncodingto obtain a Unicode converter object of this type.- iUnicodeMapping
The structure of type
UnicodeMappingto be used. This is the new mapping that replaces the existing mapping in the Unicode converter object.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
The function replaces the mapping table information that currently exists in the specified Unicode converter object with the information contained in the new Unicode mapping structure you provide.
ChangeUnicodeToTextInfo resets
the Unicode converter object’s fields as necessary. However, it
does not initialize or reset the conversion state maintained by
the Unicode converter object.
This function is especially useful for converting a string from Unicode if the Unicode string contains characters that require multiple destination encodings and you know the next destination encoding.
For example, you can change the other (destination) encoding
of the Unicode mapping structure pointed to by the iUnicodeMapping parameter
before you call the function ConvertFromUnicodeToText
to convert the next character or sequence of characters that require
a different destination encoding.
If an error is returned, the Unicode converter object is invalid.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hConvertFromPStringToUnicode
Converts a Pascal string in a Mac OS text encoding to a Unicode string.
OSStatus ConvertFromPStringToUnicode ( TextToUnicodeInfo iTextToUnicodeInfo, ConstStr255Param iPascalStr, ByteCount iOutputBufLen, ByteCount *oUnicodeLen, UniChar oUnicodeStr[] );
Parameters
- iTextToUnicodeInfo
A Unicode converter object of type
TextToUnicodeInfofor the Pascal string to be converted. You can use the functionCreateTextToUnicodeInfoorCreateTextToUnicodeInfoByEncodingto create the Unicode converter object.- iPascalStr
The Pascal string to be converted to Unicode.
- iOutputBufLen
The length in bytes of the output buffer pointed to by the
oUnicodeStrparameter. Your application supplies this buffer to hold the returned converted string. TheoUnicodeLenparameter may return a byte count that is less than this value if the converted string is smaller than the buffer size you allocated.- oUnicodeLen
On return, a pointer to the length in bytes of the converted Unicode string returned in the
oUnicodeStrparameter.- oUnicodeStr
A pointer to a Unicode character array. On return, this array holds the converted Unicode string.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
The ConvertFromPStringToUnicode function
provides an easy and efficient way to convert a short Pascal string
to a Unicode string without incurring the overhead associated with the
function ConvertFromTextToUnicode.
If necessary, this function automatically uses fallback characters to map the text elements of the string.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hConvertFromTextToUnicode
Converts a string from any encoding to Unicode.
OSStatus ConvertFromTextToUnicode ( TextToUnicodeInfo iTextToUnicodeInfo, ByteCount iSourceLen, ConstLogicalAddress iSourceStr, OptionBits iControlFlags, ItemCount iOffsetCount, const ByteOffset iOffsetArray[], ItemCount *oOffsetCount, ByteOffset oOffsetArray[], ByteCount iOutputBufLen, ByteCount *oSourceRead, ByteCount *oUnicodeLen, UniChar oUnicodeStr[] );
Parameters
- iTextToUnicodeInfo
A Unicode converter object of type
TextToUnicodeInfocontaining mapping and state information used for the conversion. The contents of this Unicode converter object are modified by the function. Your application obtains a Unicode converter object using the functionCreateTextToUnicodeInfo.- iSourceLen
The length in bytes of the source string to be converted.
- iSourceStr
The address of the source string to be converted.
- iControlFlags
Conversion control flags. You can use “Conversion Masks” to set the
iControlFlagsparameter.- iOffsetCount
The number of offsets in the
iOffsetArrayparameter. Your application supplies this value. The number of entries iniOffsetArraymust be fewer than the number of bytes specified iniSourceLen. If you don’t want offsets returned to you, specify0(zero) for this parameter.- iOffsetArray
An array of type
ByteOffset.On input, you specify the array that contains an ordered list of significant byte offsets pertaining to the source string. These offsets may identify font or style changes, for example, in the source string. All array entries must be less than the length in bytes specified by theiSourceLenparameter. If you don’t want offsets returned to your application, specifyNULLfor this parameter and0(zero) foriOffsetCount.- oOffsetCount
On return, a pointer to the number of offsets that were mapped in the output stream.
- oOffsetArray
An array of type
ByteOffset. On return, this array contains the corresponding new offsets for the Unicode string produced by the converter.- iOutputBufLen
The length in bytes of the output buffer pointed to by the
oUnicodeStrparameter. Your application supplies this buffer to hold the returned converted string. TheoUnicodeLenparameter may return a byte count that is less than this value if the converted byte string is smaller than the buffer size you allocated. The relationship between the size of the source string and the Unicode string is complex and depends on the source encoding and the contents of the string.- oSourceRead
On return, a pointer to the number of bytes of the source string that were converted. If the function returns a
kTECUnmappableElementErrresult code, this parameter returns the number of bytes that were converted before the error occurred.- oUnicodeLen
On return, a pointer to the length in bytes of the converted stream.
- oUnicodeStr
A pointer to an array used to hold a Unicode string. On input, this value points to the beginning of the array for the converted string. On return, this buffer holds the converted Unicode string. (For guidelines on estimating the size of the buffer needed, see the discussion.
Return Value
A result
code. See “TEC Manager Result Codes.” The function returns
a noErr result code if
it has completely converted the input string to Unicode without
using fallback characters.
Discussion
You specify the source string’s encoding in the Unicode
mapping structure that you pass to the function CreateTextToUnicodeInfo to obtain a
Unicode converter object for the conversion. You pass the Unicode
converter object returned by CreateTextToUnicodeInfo to ConvertFromTextToUnicode as
the iTextToUnicodeInfo parameter.
In addition to converting a text string in any encoding to
Unicode, the ConvertFromTextToUnicode function
can map offsets for style or font information from the source text
string to the returned converted string. The converter reads the application-supplied
offsets, which apply to the source string, and returns the corresponding
new offsets in the converted string. If you do not want the offsets
at which font or style information occurs mapped to the resulting
string, you should pass NULL for iOffsetArray and 0
(zero) for iOffsetCount.
Your application must allocate a buffer to hold the resulting
converted string and pass a pointer to the buffer in the oUnicodeStr parameter.
To determine the size of the output buffer to allocate, you should
consider the size of the source string, its encoding type, and its
content in relation to the resulting Unicode string.
For example, for 1-byte encodings, such as MacRoman, the Unicode
string will be at least double the size (more if it uses noncomposed
Unicode) for MacArabic and MacHebrew, the corresponding Unicode
string could be up to six times as big. For most 2-byte encodings,
for example Shift-JIS, the Unicode string will be less than double
the size. For international robustness, your application should
allocate a buffer three to four times larger than the source string.
If the output Unicode text is actually UTF-8—which could occur
beginning with the current release of the Text Encoding Conversion
Manager, version 1.2.1—the UTF-8 buffer pointer must be cast to UniCharArrayPtr before
it can be passed as the oUnicodeStr parameter.
Also, the output buffer length will have a wider range of variation
than for UTF-16; for ASCII input, the output will be the same size;
for Han input, the output will be twice as big, and so on.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hConvertFromUnicodeToPString
Converts a Unicode string to Pascal in a Mac OS text encoding.
OSStatus ConvertFromUnicodeToPString ( UnicodeToTextInfo iUnicodeToTextInfo, ByteCount iUnicodeLen, const UniChar iUnicodeStr[], Str255 oPascalStr );
Parameters
- iUnicodeToTextInfo
A Unicode converter object. You use the
CreateUnicodeToTextInfoorCreateUnicodeToTextInfoByEncodingfunction to obtain the Unicode converter object for the conversion.- iUnicodeLen
The length in bytes of the Unicode string to be converted. This is the string your application provides in the
iUnicodeStrparameter.- iUnicodeStr
A pointer to an array containing the Unicode string to be converted.
- oPascalStr
A buffer. On return, the converted Pascal string returned by the function.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
The ConvertFromUnicodeToPString function
provides an easy and efficient way to convert a Unicode string to
a Pascal string in a Mac OS text encoding without incurring the overhead
associated with use of the function ConvertFromUnicodeToText or ConvertFromUnicodeToScriptCodeRun.
If necessary, this function uses the loose mapping and fallback characters to map the text elements of the string. For fallback mappings, it uses the handler associated with the Unicode converter object.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hConvertFromUnicodeToScriptCodeRun
Converts a string from Unicode to one or more scripts.
OSStatus ConvertFromUnicodeToScriptCodeRun ( UnicodeToTextRunInfo iUnicodeToTextInfo, ByteCount iUnicodeLen, const UniChar iUnicodeStr[], OptionBits iControlFlags, ItemCount iOffsetCount, const ByteOffset iOffsetArray[], ItemCount *oOffsetCount, ByteOffset oOffsetArray[], ByteCount iOutputBufLen, ByteCount *oInputRead, ByteCount *oOutputLen, LogicalAddress oOutputStr, ItemCount iScriptRunBufLen, ItemCount *oScriptRunOutLen, ScriptCodeRun oScriptCodeRuns[] );
Parameters
- iUnicodeToTextInfo
You use the function
CreateUnicodeToTextRunInfoByScriptCodeto obtain a Unicode converter object to specify for this parameter.- iUnicodeLen
The length in bytes of the Unicode string to be converted.
- iUnicodeStr
A pointer to the Unicode string to be converted.
- iControlFlags
Conversion control flags. The following constants define the masks for control flags valid for this parameter. You can use “Conversion Masks” and “Directionality Masks” to set the
iControlFlagsparameter.If the text-run control flag is clear,
ConvertFromUnicodeToScriptCodeRunattempts to convert the Unicode text to the single script from the list of scripts in the Unicode converter object that produces the best result, that is, that provides for the greatest amount of source text conversion. If the complete source text can be converted into more than one of the scripts specified in the array, then the converter chooses among them based on their order in the array. If this flag is clear, theoScriptCodeRunsparameter always points to a value equal to 1.If you set the use-fallbacks control flag, the converter uses the default fallback characters for the current script. If the converter cannot handle a character using the current encoding, even using fallbacks, the converter attempts to convert the character using the other scripts, beginning with the first one specified in the list and skipping the one where it failed.
If you set the
kUnicodeTextRunBitcontrol flag, the converter attempts to convert the complete Unicode text string into the first script specified in the Unicode mapping structures array you passed toCreateUnicodeToTextRunInfo,CreateUnicodeToTextRunInfoByEncoding, orCreateUnicodeToTextRunInfoByScriptCodeto create the Unicode converter object used for this conversion. If it cannot do this, the converter then attempts to convert the first text element that failed to the remaining scripts, in their specified order in the array. What the converter does with the next text element depends on the setting of the keep-same-encoding control flag:If the keep-same-encoding control flag is clear, the converter returns to the original script and attempts to continue conversion with that script; this is equivalent to converting each text element to the first one that works, in the order specified.
If the Unicode-keep-same-encoding control flag is set, the converter continues with the new destination script until it encounters a text element that cannot be converted using the new script. This attempts to minimize the number of script code changes in the output text. When the converter cannot convert a text element using any of the scripts in the list and the Unicode-keep-same-encoding control flag is set, the converter uses the fallbacks default characters for the current script.
- iOffsetCount
The number of offsets in the array pointed to by the
iOffsetArrayparameter. Your application supplies this value. The number of entries iniOffsetArraymust be fewer than half the number of bytes specified iniUnicodeLen. If you don’t want offsets returned to you, specify0(zero) for this parameter.- iOffsetArray
An array of type
ByteOffset.On input, you specify the array that contains an ordered list of significant byte offsets pertaining to the source Unicode string. These offsets may identify font or style changes, for example, in the Unicode string. If you don’t want offsets returned to your application, specifyNULLfor this parameter and0(zero) foriOffsetCount.- oOffsetCount
On return, a pointer to the number of offsets that were mapped in the output stream.
- oOffsetArray
An array of type
ByteOffset. On return, this array contains the corresponding new offsets for the resulting converted string.- iOutputBufLen
The length in bytes of the output buffer pointed to by the
oOutputStrparameter. Your application supplies this buffer to hold the returned converted string. TheoOutputLenparameter may return a byte count that is less than this value if the converted byte string is smaller than the buffer size you allocated.- oInputRead
On return, a pointer to the number of bytes of the Unicode source string that were converted. If the function returns a result code other than
noErr, then this parameter returns the number of bytes that were converted before the error occurred.- oOutputLen
On return, a pointer to the length in bytes of the converted string.
- oOutputStr
A buffer address. On input, this value points to the beginning of the buffer for the converted string. On return, this buffer contains the converted string in one or more encodings. When an error occurs, the
ConvertFromUnicodeToScriptCodeRunfunction returns the converted string up to the character that caused the error.- iScriptRunBufLen
The number of script code run elements you allocated for the script code run array pointed to by the
oScriptCodeRunsparameter. The converter returns the number of valid script code runs in the location pointed to byoScriptRunOutLen. Each entry in the script code run array specifies the beginning offset in the converted text and its associated script code.- oScriptRunOutLen
A pointer to a value of type
ItemCount. On output, this value contains the number of valid script code runs returned in theoScriptCodeRunsparameter.- oScriptCodeRuns
An array of elements of type
ScriptCodeRun. Your application should allocate an array with the number of elements you specify in theiScriptRunBufLenparameter. On return, this array contains the script code runs for the converted text string. Each entry in the array specifies the beginning offset in the converted text string and the associated script code specification.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
To use the ConvertFromUnicodeToScriptCodeRun function,
you must first set up an array of script codes containing in order
of precedence the scripts to be used for the conversion. To create
a Unicode converter object, you call the function CreateUnicodeToTextRunInfoByScriptCode.
You pass the returned Unicode converter object as the iUnicodeToTextInfo parameter
when you call the ConvertFromUnicodeToScriptCodeRun function.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hConvertFromUnicodeToText
Converts a Unicode text string to the destination encoding you specify.
OSStatus ConvertFromUnicodeToText ( UnicodeToTextInfo iUnicodeToTextInfo, ByteCount iUnicodeLen, const UniChar iUnicodeStr[], OptionBits iControlFlags, ItemCount iOffsetCount, const ByteOffset iOffsetArray[], ItemCount *oOffsetCount, ByteOffset oOffsetArray[], ByteCount iOutputBufLen, ByteCount *oInputRead, ByteCount *oOutputLen, LogicalAddress oOutputStr );
Parameters
- iUnicodeToTextInfo
A Unicode converter object of type
UnicodeToTextInfofor converting text from Unicode. You use the functionCreateUnicodeToTextInfoorCreateUnicodeToTextInfoByEncodingto obtain a Unicode converter object to specify for this parameter. This function modifies the contents of theiUnicodeToTextInfoparameter.- iUnicodeLen
The length in bytes of the Unicode string to be converted.
- iUnicodeStr
A pointer to the Unicode string to be converted. If the input text is UTF-8, which is supported for versions 1.2.1 or later of the converter, you must cast the UTF-8 buffer pointer to
ConstUniCharArrayPtrbefore you can pass it as this parameter.- iControlFlags
Conversion control flags. You can use “Conversion Masks” and “Directionality Masks” to set the
iControlFlagsparameter.- iOffsetCount
The number of offsets contained in the array provided by the
iOffsetArrayparameter. Your application supplies this value. If you don’t want offsets returned to you, specify0(zero) for this parameter.- iOffsetArray
An array of type
ByteOffset. On input, you specify the array that gives an ordered list of significant byte offsets pertaining to the Unicode source string to be converted. These offsets may identify font or style changes, for example, in the source string. If you don’t want offsets returned to your application, specifyNULLfor this parameter and0(zero) foriOffsetCount. All offsets must be less thaniUnicodeLen.- oOffsetCount
On return, a pointer to the number of offsets that were mapped in the output stream.
- oOffsetArray
An array of type
ByteOffset. On return, this array contains the corresponding new offsets for the converted string in the new encoding.- iOutputBufLen
The length in bytes of the output buffer pointed to by the
oOutputStrparameter. Your application supplies this buffer to hold the returned converted string. TheoOutputLenparameter may return a byte count that is less than this value if the converted byte string is smaller than the buffer size you allocated.- oInputRead
On return, a pointer to a the number of bytes of the Unicode string that were converted. If the function returns a
kTECUnmappableElementErrresult code, this parameter returns the number of bytes that were converted before the error occurred.- oOutputLen
On return, a pointer to the length in bytes of the converted text stream.
- oOutputStr
A value of type
LogicalAddress. On input, this value points to a buffer for the converted string. On return, the buffer holds the converted text string. (For guidelines on estimating the size of the buffer needed, see the following discussion.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function can also map offsets for style or font information
from the source text string to the returned converted string. The
converter reads the application-supplied offsets and returns the
corresponding new offsets in the converted string. If you do not
want font or style information offsets mapped to the resulting string,
you should pass NULL for iOffsetArray and 0
(zero) for iOffsetCount.
Your application must allocate a buffer to hold the resulting
converted string and pass a pointer to the buffer in the oOutputStr parameter.
To determine the size of the output buffer to allocate, you should
consider the size and content of the Unicode source string in relation
to the type of encoding to which it will be converted. For example,
for many encodings, such as MacRoman and Shift-JIS, the size of
the returned string will be between half the size and the same size
as the source Unicode string. However, for some encodings that are
not Mac OS ones, such as EUC-JP, which has some 3-byte characters
for Kanji, the returned string could be larger than the source Unicode
string. For MacArabic and MacHebrew, the result will usually be
less than half the size of the Unicode string.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hConvertFromUnicodeToTextRun
Converts a string from Unicode to one or more encodings.
OSStatus ConvertFromUnicodeToTextRun ( UnicodeToTextRunInfo iUnicodeToTextInfo, ByteCount iUnicodeLen, const UniChar iUnicodeStr[], OptionBits iControlFlags, ItemCount iOffsetCount, const ByteOffset iOffsetArray[], ItemCount *oOffsetCount, ByteOffset oOffsetArray[], ByteCount iOutputBufLen, ByteCount *oInputRead, ByteCount *oOutputLen, LogicalAddress oOutputStr, ItemCount iEncodingRunBufLen, ItemCount *oEncodingRunOutLen, TextEncodingRun oEncodingRuns[] );
Parameters
- iUnicodeToTextInfo
You use the function
CreateUnicodeToTextRunInfo,CreateUnicodeToTextRunInfoByEncoding, orCreateUnicodeToTextRunInfoByScriptCodeto obtain a Unicode converter object to specify for this parameter.- iUnicodeLen
The length in bytes of the Unicode string to be converted.
- iUnicodeStr
A pointer to the Unicode string to be converted.
- iControlFlags
Conversion control flags. The following constants define the masks for control flags valid for this parameter. You can use “Conversion Masks” and “Directionality Masks” to set the
iControlFlagsparameter.If the text-run control flag is clear,
ConvertFromUnicodeToTextRunattempts to convert the Unicode text to the single encoding it chooses from the list of encodings in the Unicode mapping structures array that you provide when you create the Unicode converter object. This is the encoding that produces the best result, that is, that provides for the greatest amount of source text conversion. If the complete source text can be converted into more than one of the encodings specified in the Unicode mapping structures array, then the converter chooses among them based on their order in the array. If this flag is clear, theoEncodingRunsparameter always points to a value equal to 1.If you set the use-fallbacks control flag, the converter uses the default fallback characters for the current encoding. If the converter cannot handle a character using the current encoding, even using fallbacks, the converter attempts to convert the character using the other encodings, beginning with the first encoding specified in the list and skipping the encoding where it failed.
If you set the
kUnicodeTextRunBitcontrol flag, the converter attempts to convert the complete Unicode text string into the first encoding specified in the Unicode mapping structures array you passed toCreateUnicodeToTextRunInfo,CreateUnicodeToTextRunInfoByEncoding, orCreateUnicodeToTextRunInfoByScriptCode when you created the Unicode converter object for this conversion. If it cannot do this, the converter then attempts to convert the first text element that failed to the remaining encodings, in their specified order in the array. What the converter does with the next text element depends on the setting of the keep-same-encoding control flag.If the keep-same-encoding control flag is clear, the converter returns to the original encoding and attempts to continue conversion with that encoding; this is equivalent to converting each text element to the first encoding that works, in the order specified.
If the keep-same-encoding control flag is set, the converter continues with the new destination encoding until it encounters a text element that cannot be converted using the new encoding. This attempts to minimize the number of encoding changes in the output text. When the converter cannot convert a text element using any of the encodings in the list and the Unicode-keep-same-encoding control flag is set, the converter uses the fallbacks default characters for the current encoding.
- iOffsetCount
The number of offsets in the array pointed to by the
iOffsetArrayparameter. Your application supplies this value. If you don’t want offsets returned to you, specify0(zero) for this parameter.- iOffsetArray
An array of type
ByteOffset. On input, you specify the array that contains an ordered list of significant byte offsets pertaining to the source Unicode string. These offsets may identify font or style changes, for example, in the Unicode string. If you don’t want offsets returned to your application, specifyNULLfor this parameter and0(zero) foriOffsetCount. All offsets must be less thaniUnicodeLen.- oOffsetCount
On return, a pointer to the number of offsets that were mapped in the output stream.
- oOffsetArray
An array of type
ByteOffset. On return, this array contains the corresponding new offsets for the resulting converted string.- iOutputBufLen
The length in bytes of the output buffer pointed to by the
oOutputStrparameter. Your application supplies this buffer to hold the returned converted string. TheoOutputLenparameter may return a byte count that is less than this value if the converted byte string is smaller than the buffer size you allocated.- oInputRead
On return, a pointer to the number of bytes of the Unicode source string that were converted. If the function returns a result code other than
noErr, then this parameter returns the number of bytes that were converted before the error occurred.- oOutputLen
On return, a pointer to the length in bytes of the converted string.
- oOutputStr
A value of type
LogicalAddress. On input, this value points to the start of the buffer for the converted string. On output, this buffer contains the converted string in one or more encodings. When an error occurs, theConvertFromUnicodeToTextRunfunction returns the converted string up to the character that caused the error. (For guidelines on estimating the size of the buffer needed, see the discussion following the parameter descriptions.- iEncodingRunBufLen
The number of text encoding run elements you allocated for the encoding run array pointed to by the
oEncodingRunsparameter. The converter returns the number of valid encoding runs in the location pointed to byoEncodingRunOutLen. Each entry in the encoding runs array specifies the beginning offset in the converted text and its associated text encoding.- oEncodingRunOutLen
On return, a pointer to a the number of valid encoding runs returned in the
oEncodingRunsparameter.- oEncodingRuns
On input, an array of structures of type
TextEncodingRun. Your application should allocate an array with the number of elements you specify in theiEncodingRunBufLenparameter. On return, this array contains the encoding runs for the converted text string. Each entry in the encoding run array specifies the beginning offset in the converted text string and the associated encoding specification.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
To use the ConvertFromUnicodeToTextRun function,
you must first set up an array of structures of type UnicodeMapping containing,
in order of precedence, the mapping information for the conversion.
To create a Unicode converter object, you call the CreateUnicodeToTextRunInfo function
passing it the Unicode mapping array, or you can the CreateUnicodeToTextRunInfoByEncoding or CreateUnicodeToTextRunInfoByScriptCode functions,
which take arrays of text encodings or script codes instead of an
array of Unicode mappings. You pass the returned Unicode converter
object as the iUnicodeToTextInfo parameter
when you call the ConvertFromUnicodeToTextRun function.
Two of the control flags that you can set for the iControlFlags parameter
allow you to control how the Unicode Converter uses the multiple
encodings in converting the text string. These flags are explained
in the description of the iControlFlags parameter.
Here is a summary of how to use these two control flags:
To keep the converted text in a single encoding, clear the text-run control flag.
To keep as much contiguous converted text as possible in one encoding, set the text-run control flag and clear the keep-same-encoding control flag.
To minimize the number of resulting encoding runs and the changes of destination encoding, set both the text-run and keep-same-encoding control flags.
The ConvertFromUnicodeToTextRun function
returns the converted string in the array pointed to by the oOutputStr parameter.
Beginning with the first text element in the oOutputStr array,
the elements of the array pointed to by the oEncodingRuns parameter identify
the encodings of the converted string. The number of elements in
the oEncodingRuns array
may not correspond to the number of elements in the oOutputStr array.
This is because the oEncodingRuns array
includes only elements for the beginning of each new encoding run
in the converted string.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hCountUnicodeMappings
Counts available mappings that meet the specified matching criteria.
OSStatus CountUnicodeMappings ( OptionBits iFilter, ConstUnicodeMappingPtr iFindMapping, ItemCount *oActualCount );
Parameters
- iFilter
Filter control flags representing the six subfields of the Unicode mapping structure that this function uses to match against in determining which mappings on the system to return to your application. The filter control enumeration, described in “Unicode Matching Masks,” define the constants for the subfield’s flags and their masks. You can include in the search criteria any of the three text encoding subfields for both the Unicode encoding and the other specified encoding. For any flag not turned on, the subfield value is ignored and the function does not check the corresponding subfield of the mappings on the system.
- iFindMapping
A structure of type
UnicodeMappingcontaining the text encodings whose field values are to be matched.- oActualCount
On return, a pointer to the number of matching mappings found.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You can filter on any of the three text encoding subfields
of the Unicode mapping structure’s unicodeEncoding specification
and on any of the three text encoding subfields of the structure’s otherEncoding specification.
The iFilter parameter
consists of a set of six control flags that you set to identify
which of the corresponding six subfields to include in the match
count. No filtering is performed on fields for which you do not
set the corresponding filter control flag.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hCreateTextEncoding
Creates and returns a text encoding specification.
TextEncoding CreateTextEncoding ( TextEncodingBase encodingBase, TextEncodingVariant encodingVariant, TextEncodingFormat encodingFormat );
Parameters
- encodingBase
A base text encoding.
- encodingVariant
A variant of the base text encoding. To specify the default variant for the base encoding given in the
encodingBaseparameter, you can use thekTextEncodingDefaultVariantconstant.- encodingFormat
A format for the base text encoding. To specify the default format for the base encoding, you can use the
kTextEncodingDefaultFormatconstant. If you want to obtain aTextEncodingvalue that references UTF-16 or UTF-8, passkUnicode16BitFormatorkUnicodeUTF8Format.
Return Value
The text encoding specification that the function creates from the values you pass it.
Discussion
When you create a text encoding specification, the three values
that you specify are packed into an unsigned integer, which you
can then pass by value to the functions that use text encodings.
See the data type TextEncodingRun.
Availability
- Available in OS X v10.0 and later.
Carbon Porting Notes
Declared In
TextCommon.hCreateTextToUnicodeInfo
Creates and returns a Unicode converter object containing information required for converting strings from a non-Unicode encoding to Unicode.
OSStatus CreateTextToUnicodeInfo ( ConstUnicodeMappingPtr iUnicodeMapping, TextToUnicodeInfo *oTextToUnicodeInfo );
Parameters
- iUnicodeMapping
A pointer to a structure of type
UnicodeMapping. Your application provides this structure to identify the mapping to use for the conversion. You must supply a value of typeTextEncodingin theunicodeEncodingfield of this structure. ATextEncodingis a triple composed of an encoding base, an encoding variant, and a format. You can obtain aUnicodeMappingvalue by calling the functionCreateTextEncoding.- oTextToUnicodeInfo
On return, the Unicode converter object holds mapping table information you supplied as the
UnicodeMappingparameter and state information related to the conversion. This information is required for conversion of a text stream in a non-Unicode encoding to Unicode.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You pass a Unicode converter object returned from the function
CreateTextToUnicodeInfo to the function ConvertFromTextToUnicode or ConvertFromPStringToUnicode
to identify the information to be used for the conversion. These
two functions modify the contents of the object.
You pass a Unicode converter object returned from CreateTextToUnicodeInfo to
the function TruncateForTextToUnicode
to identify the information to be used to truncate the string. This
function does not modify the contents of the Unicode converter object.
If an error is returned, the Unicode converter object is invalid.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hCreateTextToUnicodeInfoByEncoding
Based on the given text encoding specification, creates and returns a Unicode converter object containing information required for converting strings from the specified non-Unicode encoding to Unicode.
OSStatus CreateTextToUnicodeInfoByEncoding ( TextEncoding iEncoding, TextToUnicodeInfo *oTextToUnicodeInfo );
Parameters
- iEncoding
The text encoding specification for the source text.
- oTextToUnicodeInfo
The Unicode converter object of type
TextToUnicodeInforeturned by the function.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You can use this function instead of the CreateTextToUnicodeInfo function when
you do not need to create a Unicode mapping structure. You simply
specify the text encoding of the source text. However, this method
is less efficient because the text encoding parameter must be resolved
internally into a Unicode mapping.
You cannot specify a version of Unicode. The function uses a 16-bit form of Unicode as the default.
You pass a Unicode converter object returned from CreateTextToUnicodeInfoByEncoding to the
function ConvertFromTextToUnicode
or ConvertFromPStringToUnicode
to identify the information to be used for the conversion. These
two functions modify the contents of the Unicode converter object.
You pass a Unicode converter object returned from CreateTextToUnicodeInfoByEncoding to the
function TruncateForTextToUnicode
to identify the information to be used to truncate the string. This
function does not modify the contents of the Unicode converter object.
If you are converting the text stream to Unicode as an intermediary
encoding, and then from Unicode to the final destination encoding,
you use the function CreateUnicodeToTextInfo
to create a Unicode converter object for the second part of the process.
Availability
- Available in OS X v10.0 and later.
Carbon Porting Notes
Declared In
UnicodeConverter.hCreateUnicodeToTextInfo
Creates and returns a Unicode converter object containing information required for converting strings from Unicode to a non-Unicode encoding.
OSStatus CreateUnicodeToTextInfo ( ConstUnicodeMappingPtr iUnicodeMapping, UnicodeToTextInfo *oUnicodeToTextInfo );
Parameters
- iUnicodeMapping
A pointer to a structure of type
UnicodeMapping. Your application provides this structure to identify the mapping to be used for the conversion. TheunicodeEncodingfield of this structure can specify a Unicode format ofkUnicode16BitFormatorkUnicodeUTF8Format. Note that the versions of the Unicode Converter prior to 1.2.1 do not supportkUnicodeUTF8Format.- oUnicodeToTextInfo
On return, a pointer to a Unicode converter object that holds the mapping table information you supply as the
iUnicodeMappingparameter and the state information related to the conversion. The information contained in the Unicode converter object is required for the conversion of a Unicode string to a non-Unicode encoding.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You pass the Unicode converter object returned from CreateUnicodeToTextInfo to
the function ConvertFromUnicodeToText
or ConvertFromUnicodeToPString
to identify the information to be used for the conversion. These
two functions modify the contents of the Unicode converter object.
If an error is returned, the Unicode converter object is invalid.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hCreateUnicodeToTextInfoByEncoding
Based on the given text encoding specification for the converted text, creates and returns a Unicode converter object containing information required for converting strings from Unicode to the specified non-Unicode encoding.
OSStatus CreateUnicodeToTextInfoByEncoding ( TextEncoding iEncoding, UnicodeToTextInfo *oUnicodeToTextInfo );
Parameters
- iEncoding
The text encoding specification for the destination, or converted, text.
- oUnicodeToTextInfo
A pointer to a Unicode converter object of type
UnicodeToTextInfo.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You can use this function instead of the CreateUnicodeToTextInfo function to
create a Unicode converter. However, this method is less efficient
internally because the destination text encoding you specify must
be resolved into a Unicode mapping. Using this function, you cannot
specify a version of Unicode, so a default version of Unicode is used;
16-bit format is assumed.
You pass a Unicode converter object returned from the function CreateUnicodeToTextInfoByEncoding to
the function ConvertFromUnicodeToText
or ConvertFromUnicodeToPString
to identify the information to be used for the conversion. These
two functions modify the contents of the Unicode converter object.
You pass a Unicode converter object returned from CreateUnicodeToTextInfoByEncoding to the
function TruncateForUnicodeToText
to identify the information to be used to truncate the string. This
function does not modify the contents of the Unicode converter object.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hCreateUnicodeToTextRunInfo
Creates and returns a Unicode converter object containing the information required for converting a Unicode text string to strings in one or more non-Unicode encodings.
OSStatus CreateUnicodeToTextRunInfo ( ItemCount iNumberOfMappings, const UnicodeMapping iUnicodeMappings[], UnicodeToTextRunInfo *oUnicodeToTextInfo );
Parameters
- iNumberOfMappings
The number of mappings specified by your application for converting from Unicode to any other encoding types, including other forms of Unicode. If you pass 0 for this parameter, the converter will use all of the scripts installed in the system. The primary script is the one with highest priority;
ScriptOrder('itlm'resource) determines the priority of the rest. If you set the high-order bit for this parameter, the Unicode converter assumes that theiEncodingsparameter contains a single element specifying the preferred encoding. This feature is supported for versions 1.2 or later of the converter.- iUnicodeMappings
A pointer to an array of structures of type
UnicodeMapping. Your application provides this structure to identify the mappings to be used for the conversion. The order in which you specify the mappings determines the priority of the destination encodings. For this function, the Unicode mapping structure can specify a Unicode format ofkUnicode16BitFormatorkUnicodeUTF8Format. Note that the versions of the Unicode Converter prior to the Text Encoding Conversion Manager 1.2.1 do not supportkUnicodeUTF8Format. Also, note that theunicodeEncodingfield should be the same for all of the entries iniUnicodeMappings. If you passNULLfor theiUnicodeMappingsparameter, the converter uses all of the scripts installed in the system, assuming the default version of Unicode with 16-bit format. The primary script is the one with the highest priority andScriptOrder('itlm'resource) determines the priority of the rest. This is supported beginning with version 1.2 of the Text Encoding Conversion Manager.- oUnicodeToTextInfo
A pointer to a Unicode converter object for converting Unicode text strings to strings in one or more non-Unicode encodings. On return, a pointer to a Unicode converter object that holds the mapping table information you supply as the
iUnicodeMappingsparameter and the state information related to the conversion.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You pass a Unicode converter object returned from the function CreateUnicodeToTextRunInfo to
the function ConvertFromUnicodeToTextRun
or ConvertFromUnicodeToScriptCodeRun
to identify the information to be used for the conversion. These
two functions modify the contents of the Unicode converter object.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hCreateUnicodeToTextRunInfoByEncoding
Based on the given text encoding specifications for the converted text runs, creates and returns a Unicode converter object containing information required for converting strings from Unicode to one or more specified non-Unicode encodings.
OSStatus CreateUnicodeToTextRunInfoByEncoding ( ItemCount iNumberOfEncodings, const TextEncoding iEncodings[], UnicodeToTextRunInfo *oUnicodeToTextInfo );
Parameters
- iNumberOfEncodings
The number of desired encodings. If you pass 0 for this parameter, the converter will use all of the scripts installed in the system. The primary script is the one with highest priority;
ScriptOrder('itlm'resource) determines the priority of the rest. If you set the high-order bit for this parameter, the Unicode converter assumes that theiEncodingsparameter contains a single element specifying the preferred encoding. This feature is supported for versions 1.2 or later of the converter.- iEncodings
An array of text encoding specifications for the desired encodings. Your application provides this structure to identify the encodings to be used for the conversion. The order in which you specify the encodings determines the priority of the destination encodings. If you pass
NULLfor this parameter, the converter will use all of the scripts installed in the system. The primary script is the one with highest priority andScriptOrder('itlm' resource) determines the priority of the rest.This feature is supported for versions 1.2 or later of the converter.- oUnicodeToTextInfo
A pointer to a Unicode converter object for converting Unicode text strings to strings in one or more non-Unicode encodings. On return, a pointer to a Unicode converter object that holds the encodings you supply as the
iEncodingsparameter and the state information related to the conversion.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You pass a Unicode converter object returned from CreateUnicodeToTextRunInfoByEncoding to
the function ConvertFromUnicodeToTextRun
or ConvertFromUnicodeToScriptCodeRun
to identify the information to be used for the conversion. These
two functions modify the contents of the Unicode converter object.
If an error is returned, the converter object is invalid.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hCreateUnicodeToTextRunInfoByScriptCode
Based on the given script codes for the converted text runs, creates and returns a Unicode converter object containing information required for converting strings from Unicode to one or more specified non-Unicode encodings.
OSStatus CreateUnicodeToTextRunInfoByScriptCode ( ItemCount iNumberOfScriptCodes, const ScriptCode iScripts[], UnicodeToTextRunInfo *oUnicodeToTextInfo );
Parameters
- iNumberOfScriptCodes
The number of desired scripts. If you pass 0 for this parameter, the converter uses all the scripts installed in the system. In this case, the primary script is the one with highest priority;
ScriptOrder(’itlm’resource) determines the priority of the rest. If you set the high-order bit for this parameter, the Unicode converter assumes that theiScriptsparameter contains a single element specifying the preferred script. This feature is supported beginning with the Text Encoding Conversion Manager 1.2.- iScripts
An array of script codes for the desired scripts. Your application provides this structure to identify the scripts to be used for the conversion. The order in which you specify the scripts determines their priority. If you pass
NULLfor this parameter, the converter uses all of the scripts installed in the system. In this case, the primary script is the one with the highest priority and the priority order of the remaining scripts is defined by theScriptOrder(itlm resource)resource. This feature is supported for versions 1.2 or later of the converter.- oUnicodeToTextInfo
A pointer to a Unicode converter object for converting Unicode text strings to strings in one or more non-Unicode encodings. On return, a pointer to Unicode converter object that holds the scripts you supply as the
iScriptsparameter and the state information related to the conversion.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You pass a Unicode converter object returned from CreateUnicodeToTextRunInfoByScriptCode to
the function ConvertFromUnicodeToTextRun
or ConvertFromUnicodeToScriptCodeRun
to identify the information to be used for the conversion. These
two functions modify the contents of the Unicode converter object.
Availability
- Available in OS X v10.0 and later.
Carbon Porting Notes
Declared In
UnicodeConverter.hDisposeTextToUnicodeInfo
Releases the memory allocated for the specified Unicode converter object.
OSStatus DisposeTextToUnicodeInfo ( TextToUnicodeInfo *ioTextToUnicodeInfo );
Parameters
- ioTextToUnicodeInfo
A pointer to a Unicode converter object of type
TextToUnicodeInfo, used for converting text to Unicode. On input, you specify the object to dispose. It must be an object which your application created using the functionCreateTextToUnicodeInfoorCreateTextToUnicodeInfoByEncoding. You must not point to any other type of Unicode converter object. Your application should not use this function with the same structure more than once.
Return Value
A result
code. See “TEC Manager Result Codes.” If your application specifies
an invalid Unicode converter object, such as NULL,
the function returns a paramErr result
code.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hDisposeUnicodeToTextFallbackUPP
Disposes of a a new universal procedure pointer (UPP) to a Unicode-to-text fallback callback.
void DisposeUnicodeToTextFallbackUPP ( UnicodeToTextFallbackUPP userUPP );
Parameters
- userUPP
The universal procedure pointer.
Discussion
See the callback UnicodeToTextFallbackProcPtr for
more information.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hDisposeUnicodeToTextInfo
Releases the memory allocated for the specified Unicode converter object.
OSStatus DisposeUnicodeToTextInfo ( UnicodeToTextInfo *ioUnicodeToTextInfo );
Parameters
- ioUnicodeToTextInfo
A pointer to a Unicode converter object for converting from Unicode to a non-Unicode encoding. You specify a Unicode converter object that your application created using the function
CreateUnicodeToTextInfoorCreateUnicodeToTextInfoByEncoding. You must not point to any other type of Unicode converter object. Your application should not attempt to dispose of the same Unicode converter object more than once.
Return Value
A result
code. See “TEC Manager Result Codes.” The function returns noErr if
it disposes of the Unicode converter object successfully. If your application
specifies an invalid Unicode converter object, such as NULL,
the function returns a paramErr result
code.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hDisposeUnicodeToTextRunInfo
Releases the memory allocated for the specified Unicode converter object.
OSStatus DisposeUnicodeToTextRunInfo ( UnicodeToTextRunInfo *ioUnicodeToTextRunInfo );
Parameters
- ioUnicodeToTextRunInfo
A pointer to a Unicode converter object. On input, you specify a Unicode converter object that points to the conversion information to dispose. It must be an object which your application created using the function
CreateUnicodeToTextRunInfo,CreateUnicodeToTextRunInfoByEncoding, orCreateUnicodeToTextRunInfoByScriptCode. You must point to any other type of Unicode converter object. Your application should not use this function with the same structure more than once.
Return Value
A result
code. See “TEC Manager Result Codes.” If your application specifies
an invalid Unicode converter object, such as NULL,
the function returns paramErr.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hGetTextEncodingBase
Returns the base encoding of the specified text encoding.
TextEncodingBase GetTextEncodingBase ( TextEncoding encoding );
Parameters
- encoding
A text encoding specification whose base encoding you want to obtain.
Return Value
The base encoding portion of the specified text encoding.
Discussion
See the data type TextEncodingRun
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hGetTextEncodingFormat
Returns the format value of the specified text encoding.
TextEncodingFormat GetTextEncodingFormat ( TextEncoding encoding );
Parameters
- encoding
A text encoding specification.
Return Value
The text encoding format value contained in the text encoding you specified.
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hGetTextEncodingName
Returns the localized name for a specified text encoding.
OSStatus GetTextEncodingName ( TextEncoding iEncoding, TextEncodingNameSelector iNamePartSelector, RegionCode iPreferredRegion, TextEncoding iPreferredEncoding, ByteCount iOutputBufLen, ByteCount *oNameLength, RegionCode *oActualRegion, TextEncoding *oActualEncoding, TextPtr oEncodingName );
Parameters
- iEncoding
A text encoding specification whose name you want to obtain.
- iNamePartSelector
The portion of the encoding name you want to obtain. See “Text Encoding Name Selectors” for a list of possible values.
- iPreferredRegion
The preferred region to use for the name. You can specify a Mac OS region code (which also implies a language) for this parameter. If the function cannot return the name for the preferred region, it returns the name using a region code with the same language or in a default language (for example, English).
- iPreferredEncoding
The preferred encoding to use for the name. For example, ASCII, Mac OS Roman, or Shift-JIS. If the function cannot return the name using the preferred encoding, it returns the name using another encoding, such as Unicode or ASCII.
- iOutputBufLen
The length in bytes of the output buffer that your application provides for the returned encoding name.
- oNameLength
A pointer to a value of type
ByteCount. On return, this parameter holds the actual length, in bytes, of the text encoding name. The value represents the full length of the name, which might be greater than the size of the output buffer, specified by theiOutputBufLenparameter. The length of the portion of the name actually contained in the output buffer is the smaller ofoNameLengthandiOutputBufLen.- oActualRegion
A pointer to a value of type
RegionCode. On return, this parameter holds the actual region associated with the returned encoding name.- oActualEncoding
A pointer to a value of type
TextEncoding. On return, this parameter holds the actual encoding associated with the returned encoding name.- oEncodingName
A pointer to a buffer you provide. On return, this parameter holds the text encoding name.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
Names returned by GetTextEncodingName
(in the buffer referred to by oEncodingName)
can contain parentheses and other menu item meta characters, and
so cannot be used with AppendMenu or InsertMenuItem.
You can use them with SetMenuItemText.
This function can return resources and memory errors, and the following result codes:
kTextUnsupportedEncodingErr, which indicates that the encoding whose name you want to obtain is not supported.kTECMissingTableErr, which indicates the name resource associated with the encoding is missing.kTECTableFormatErrorkTECTableCheckSumErr, which indicates that the name resource associated with that encoding is invalid.
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hGetTextEncodingVariant
Returns the variant from the specified text encoding.
TextEncodingVariant GetTextEncodingVariant ( TextEncoding encoding );
Parameters
- encoding
A text encoding specification.
Return Value
The text encoding variant portion of the specified text encoding.
Availability
- Available in OS X v10.0 and later.
Carbon Porting Notes
Declared In
TextCommon.hInvokeUnicodeToTextFallbackUPP
Calls your Unicode-to-text fallback callback.
OSStatus InvokeUnicodeToTextFallbackUPP ( UniChar *iSrcUniStr, ByteCount iSrcUniStrLen, ByteCount *oSrcConvLen, TextPtr oDestStr, ByteCount iDestStrLen, ByteCount *oDestConvLen, LogicalAddress iInfoPtr, ConstUnicodeMappingPtr iUnicodeMappingPtr, UnicodeToTextFallbackUPP userUPP );
Discussion
You should not need to use the function InvokeUnicodeToTextFallbackUPP,
as the system calls your Unicode-to-text fallback callback for you.
See the callback UnicodeToTextFallbackProcPtr for
more information.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hNearestMacTextEncodings
Obtains the best and alternate Mac text encoding.
OSStatus NearestMacTextEncodings ( TextEncoding generalEncoding, TextEncoding *bestMacEncoding, TextEncoding *alternateMacEncoding );
Parameters
- generalEncoding
The text encoding for which you want to obtain a Mac text encoding.
- bestMacEncoding
On return, the Mac text encoding that best matches the encoding specified by the
generalEncodingparameter.- alternateMacEncoding
On return, the Mac text encoding that is the second best match for the encoding specified by the
generalEncodingparameter.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hNewUnicodeToTextFallbackUPP
Creates a new universal procedure pointer (UPP) to a Unicode-to-text fallback callback.
UnicodeToTextFallbackUPP NewUnicodeToTextFallbackUPP ( UnicodeToTextFallbackProcPtr userRoutine );
Parameters
- userRoutine
A pointer to your Unicode-to-text fallback callback.
Return Value
On return, a UPP to the Unicode-to-text fallback callback.
Discussion
See the callback UnicodeToTextFallbackProcPtr for
more information.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hQueryUnicodeMappings
Returns a list of the conversion mappings available on the system that meet specified matching criteria and returns the number of mappings found.
OSStatus QueryUnicodeMappings ( OptionBits iFilter, ConstUnicodeMappingPtr iFindMapping, ItemCount iMaxCount, ItemCount *oActualCount, UnicodeMapping oReturnedMappings[] );
Parameters
- iFilter
Filter control flags representing the six values given in the Unicode mapping structure that this function uses to match against in determining which mappings on the system to return to your application. The filter control flag enumerations, described in “Unicode Matching Masks,” define the constants for the flags and their masks. You can include in the search criteria any of the three text encoding values—base, variant, and format—for both the Unicode encoding and the other specified encoding. For any flag not turned on, the value is ignored the function does not check the corresponding value of the mapping tables on the system.
- iFindMapping
A structure of type
UnicodeMappingcontaining the text encodings whose values are to be matched.- iMaxCount
The maximum number of mappings that can be returned. You provide this value to identify the number of elements in the array pointed to by the
oReturnedMappingsparameter that your application allocated. If the function identifies more matching mappings than the array can hold, it returns as many of them as fit. The function also returns akTECArrayFullErrin this case.- oActualCount
On return, a pointer to the number of matching mappings found. This number may be greater than the number of mappings specified by
iMaxCountif more matching mappings are found than can fit in theoReturnedMappingsarray.- oReturnedMappings
A pointer to an array of structures of type
UnicodeMapping. On input, this pointer refers to an array for the matching mappings returned by the function. To allocate sufficient elements for the array, you can use the functionCountUnicodeMappingsto determine the number of mappings returned for given values of theiFilterandiFindMappingparameters. On return, a pointer to an array that holds the matching mappings. If there are more matches than the array can hold, the function returns as many of them as will fit and akTECBufferBelowMinimumSizeErrerror result. TheoActualCountparameter identifies the number of matching mappings actually found, which may be greater than the number returned.
Return Value
A result
code. See “TEC Manager Result Codes.” If the function returns
a noErr result code,
the value retuned in the oActualCount parameter
is less than or equal to the value returned in the iMaxCount parameter
and the oReturnedMappings parameter
contains all of the matching mappings found. If the function returns
a kTECArrayFullErr, the
function found more mappings than your oReturnedMappings array
could accommodate.
Discussion
You can use the QueryUnicodeMappings function
to obtain all mappings on the system up to the number allowed by
your oReturnedMappings array
by specifying a value of zero for the iFilter field.
You can use the function to obtain very specific mappings
by setting individual filter control flags. You can filter on any
of the three text encoding subfields of the Unicode mapping structure’s unicodeEncoding specification
and on any of the three text encoding subfields of the mapping’s otherEncoding specification.
The iFilter parameter
consists of a set of six control flags that you set to identify
which of the corresponding six subfields to include in the match.
The list provided in the oReturnedMappings parameter
will contain only mappings that match the fields of the Unicode
mapping structure whose text encodings subfields you identify in
the filter control flags. No filtering is performed on subfields
for which you do not set the corresponding filter control flag.
For example, to obtain a list of all mappings in which one
of the encodings is the default variant and default format of the
Unicode 1.1 base encoding and the other encoding is the default
variant and default format of a base encoding other than Unicode,
you would set up the iFilter and iFindMappings parameter
as follows. To set up these parameters, you use the constants defined
for the text encoding bases, the text encoding default variants, the
text encoding default formats, and the filter control flag bitmasks.
In this example, the text encoding base field of the Unicode mapping
structure’s otherEncoding field
is ignored, so you can specify any value for it. When you call QueryUnicodeMappings,
passing it these parameters, the function will return a list of
mappings between the Unicode encoding you specified and every other
available encoding in which each non-Unicode base encoding shows
up once because you specified its default variant and default format.
iFindMapping.unicodeMapping = CreateTextEncoding( |
kTextEncodingUnicodeV1_1, |
kTextEncodingDefaultVariant, |
kTextEncodingDefaultFormat); |
iFindMapping.otherEncoding = CreateTextEncoding( |
kTextEncodingMacRoman, |
kTextEncodingDefaultVariant, |
kTextEncodingDefaultFormat); |
iFilter = kUnicodeMatchUnicodeBaseMask | |
kUnicodeMatchUnicodeVariantMask | |
kUnicodeMatchUnicodeFormatMask | |
kUnicodeMatchOtherVariantMask | |
kUnicodeMatchOtherFormatMask; |
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hResetTextToUnicodeInfo
Reinitializes all state information kept by the context objects.
OSStatus ResetTextToUnicodeInfo ( TextToUnicodeInfo ioTextToUnicodeInfo );
Parameters
- ioTextToUnicodeInfo
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hResetUnicodeToTextInfo
Reinitializes all state information kept by a Unicode converter object.
OSStatus ResetUnicodeToTextInfo ( UnicodeToTextInfo ioUnicodeToTextInfo );
Parameters
- ioUnicodeToTextInfo
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Carbon Porting Notes
Declared In
UnicodeConverter.hResetUnicodeToTextRunInfo
Reinitializes all state information kept by the context objects in TextRun conversions.
OSStatus ResetUnicodeToTextRunInfo ( UnicodeToTextRunInfo ioUnicodeToTextRunInfo );
Parameters
- ioUnicodeToTextRunInfo
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hResolveDefaultTextEncoding
Returns a text encoding specification in which any meta-values have been resolved to real values. Currently, this affects only the base encoding values packed into the text encoding specification.
TextEncoding ResolveDefaultTextEncoding ( TextEncoding encoding );
Parameters
- encoding
A text encoding specification possibly containing meta-values that you want to resolve to a text encoding specification containing only real values.
Return Value
A text encoding specification containing only real base encoding values.
Discussion
This function is useful for application developers who are providing APIs that take text encoding specifications as parameters. All APIs in the Unicode Converter and Text Encoding Converter perform this translation automatically.
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hRevertTextEncodingToScriptInfo
Converts the given Mac OS text encoding specification to the corresponding script code and, if possible, language code and font name.
OSStatus RevertTextEncodingToScriptInfo ( TextEncoding iEncoding, ScriptCode *oTextScriptID, LangCode *oTextLanguageID, Str255 oTextFontname );
Parameters
- iEncoding
The text encoding specification to be converted.
- oTextScriptID
A pointer to a value of type
ScriptCode. On return, a Mac OS script code that corresponds to the text encoding specification you identified in theiEncodingparameter. If you do not pass a pointer for this parameter, the function returns aparamErrresult code.- oTextLanguageID
A pointer to a value of type
LangCode. On input, if you do not want the function to return the language code, specifyNULLas the value of this parameter. On return, the appropriate language code, if the language can be unambiguously derived from the text encoding specification, for example, Japanese, and you did not set the parameter toNULL.If you do not specify
NULLon input and the language is ambiguous—that is, the function cannot accurately derive it from the text encoding specification—the function returns a value ofkTextLanguageDontCare.- oTextFontname
A Pascal string. On input, if you do not want the function to return the font name, specify
NULLas the value of this parameter. On return, the name of the appropriate font if the font can be unambiguously derived from the text encoding specification, for example, Symbol, and you did not set the parameter toNULL.If you do not specify
NULLon input and the font is ambiguous—that is, the function cannot accurately derive it from the text encoding specification—the function returns a zero-length string.
Return Value
A result code. See “TEC Manager Result Codes.”
The function returns paramErr if
the text encoding specification input parameter value is invalid. The
function returns a kTECTableFormatErr result
code if the internal mapping tables used for translation are invalid.
For a list of other possible result codes, see “Data Types”.
Discussion
If you have applications that use Mac OS Script Manager and
Font Manager functions, you can use the RevertTextEncodingToScriptInfo function
to convert information in a text encoding specification into the
appropriate Mac OS script code, language code, and font name, if
they can be unambiguously derived. Your application can then use
this information to display text to a user on the screen.
For more information see the UpgradeScriptInfoToTextEncoding function
and “Base Text Encodings.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hSetFallbackUnicodeToText
Specifies a fallback handler to be used for converting a Unicode text segment to another encoding when the Unicode Converter cannot convert the text using the mapping table specified by the Unicode converter object.
OSStatus SetFallbackUnicodeToText ( UnicodeToTextInfo iUnicodeToTextInfo, UnicodeToTextFallbackUPP iFallback, OptionBits iControlFlags, LogicalAddress iInfoPtr );
Parameters
- iUnicodeToTextInfo
\The Unicode converter object to which the fallback handler is to be associated. You use the function
CreateUnicodeToTextInfoorCreateUnicodeToTextInfoByEncodingto obtain a Unicode converter object of this type.- iFallback
A universal procedure pointer to the application-defined fallback routine. For a description of the function prototype that your fallback handler must adhere to and how to create your own fallback handler, see
UnicodeToTextFallbackProcPtr. You should use theNewUnicodeToTextFallbackProcmacro to convert a pointer to your fallback handler into aUnicodeToTextFallbackUPP.- iControlFlags
Control flags that stipulate which fallback handler the Unicode Converter should call—the application-defined fallback handler or the default handler—if a fallback handler is required, and the sequence in which the Unicode Converter should call the fallback handlers if either can be used when the other fails or is unavailable. See “Fallback Handler Selectors.”
- iInfoPtr
A point to a block of memory to be passed to the application-defined fallback handler. The Unicode Converter passes this pointer to the application-defined fallback handler as the last parameter when it calls the fallback handler. Your application can use this memory block to store data required by your fallback handler whenever it is called. This is similar in use to a reference constant (refcon). If you don’t need to use a memory block, specify
NULLfor this parameter.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You can define multiple fallback handlers and associate them
with different Unicode converter objects, depending on your requirements.
See UnicodeToTextFallbackProcPtr for
a description of how to create and install an application-defined
fallback handler.
You can use a fallback handler when one of the Unicode conversion
functions, ConvertFromUnicodeToText ,
ConvertFromUnicodeToTextRun ,
ConvertFromUnicodeToPString ,
and ConvertFromUnicodeToScriptCodeRun ,
cannot convert the text using the mapping table specified by the
Unicode converter object passed to the function.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hSetFallbackUnicodeToTextRun
Specifies a fallback handler to be used for converting a Unicode text segment to another encoding when the Unicode Converter cannot convert the text using the mapping table specified by a Unicode converter object.
OSStatus SetFallbackUnicodeToTextRun ( UnicodeToTextRunInfo iUnicodeToTextRunInfo, UnicodeToTextFallbackUPP iFallback, OptionBits iControlFlags, LogicalAddress iInfoPtr );
Parameters
- iUnicodeToTextRunInfo
The Unicode converter object to which the fallback handler is to be associated. You use the function
CreateUnicodeToTextRunInfo,CreateUnicodeToTextRunInfoByEncoding, orCreateUnicodeToTextRunInfoByScriptCodeto obtain a Unicode converter object to specify for this parameter.- iFallback
A universal procedure pointer to the application-defined fallback routine. For a description of the function prototype to which your fallback handler must adhere and how to create your own fallback handler, see
UnicodeToTextFallbackProcPtr. You should use theNewUnicodeToTextFallbackProcmacro described in the discussion of the functionSetFallbackUnicodeToText.- iControlFlags
Control flags that stipulate which fallback handler the Unicode Converter should call—the application-defined fallback handler or the default handler—if a fallback handler is required, and the sequence in which the Unicode Converter should call the fallback handlers if either can be used when the other fails or is unavailable. See “Fallback Handler Selectors.”
- iInfoPtr
A pointer to a block of memory to be passed to the application-defined fallback handler. The Unicode Converter passes this pointer to the application-defined fallback handler as the last parameter when it calls the fallback handler. Your application can use this block to store data required by your fallback handler whenever it is called. This is similar in use to a reference constant (refcon). If you don’t need to use a memory block, specify
NULLfor this parameter.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You can define multiple fallback handlers and associate them
with different Unicode converter objects, depending on your requirements.
See UnicodeToTextFallbackProcPtr for a
description of how to create and install an application-defined
fallback handler.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hTECClearConverterContextInfo
Resets a converter object to its initial state so you can reuse it.
OSStatus TECClearConverterContextInfo ( TECObjectRef encodingConverter );
Parameters
- encodingConverter
A reference to the text encoding converter object you want to reset. It can be a reference returned by the
TECCreateConverter,TECCreateOneToManyConverter, orTECCreateConverterFromPathfunctions.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
It is more efficient to reuse an existing converter object than to create a new one that contains the same conversion information. This function clears the text string, but does not alter the source and destination encodings.
If you are converting multiple segments of a text string, you should not clear the converter object until you have converted all the text segments.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECClearSnifferContextInfo
Resets a sniffer object to its initial settings so you can reuse it.
OSStatus TECClearSnifferContextInfo ( TECSnifferObjectRef encodingSniffer );
Parameters
- encodingSniffer
A pointer to the sniffer object you want to reset.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
Sniffers maintain state information about the input encoding
buffer and the number of errors and features found for each encoding;
this information allows a caller to progressively sniff an input
buffer in sequential chunks. Before sniffing a buffer that contains
completely new information you must clear any state information
by calling TECClearSnifferContextInfo.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECConvertText
Converts a stream of text from a source encoding to a destination encoding. It uses the conversion path specified by the converter object you supply.
OSStatus TECConvertText ( TECObjectRef encodingConverter, ConstTextPtr inputBuffer, ByteCount inputBufferLength, ByteCount *actualInputLength, TextPtr outputBuffer, ByteCount outputBufferLength, ByteCount *actualOutputLength );
Parameters
- encodingConverter
A reference to the text encoding converter object you want to use for the conversion. It can be a reference returned by the
TECCreateConverterorTECCreateConverterFromPathfunctions.- inputBuffer
The stream of text you want to convert.
- inputBufferLength
The length in bytes (
UInt8orunsigned char) of the stream of text.- actualInputLength
On return, a pointer to the number of source text bytes that were converted from the input buffer.
- outputBuffer
A pointer to a buffer for a byte stream. On output, the buffer holds the converted text.
- outputBufferLength
The length in bytes of the
outputBufferparameter.- actualOutputLength
On return, a pointer to the number of bytes of converted text returned in the
outputBufferparameter.
Return Value
A result
code. See “TEC Manager Result Codes.” If there is not enough memory
available for TECConvertText to
convert the text when allocating internal buffers, the function
returns the appropriate Memory Manager result code.
In most cases, TECConvertText does not return “kTECUsedFallbacksStatus” even if it has substituted a fallback character in the process of converting its input text to output in another encoding (unlike, for example, ConvertFromUnicodeToText which always returns “kTECUsedFallbacksStatus” if it substitutes a fallback character). That is because TECConvertText is intended to be used primarily by clients who just want it to do the best job it can in converting from a given input encoding to a given output encoding and don't want to worry too much about the details.
Discussion
If the output buffer you allocate is too small to accommodate any of the converted text, the function fails. For best results, you should follow these guidelines when you allocate an output buffer:
Base the buffer length on an estimate of the byte requirements of the destination encoding. Make sure you account for additional bytes needed by the destination encoding (for example, an escape sequence) in addition to the actual text.
Always allocate a buffer at least 32 bytes long.
If size is a concern, make sure the output buffer is at least large enough to hold a portion of the converted text. You can convert part of the text, then use the value of the
actualInputLengthparameter to identify the next byte to be taken and to determine how many bytes remain. To convert the remaining text, you simply call the function again with the remaining text and a new output buffer.If the destination encoding is a character encoding scheme—such as ISO-2022-JP, which begins in ASCII and switches to other coded character sets through limited combinations of escape sequences—then you need to allocate enough space to accommodate escape sequences that signal switches. ISO-2022-JP requires 3 to 5 bytes for an escape sequence preceding the 1-byte or 2-byte character it introduces. If you allocate a buffer that is less than 5 bytes, the TECConvertText function could fail, depending on the text being converted.
To make sure that you receive all of the converted text, you
should call the function TECFlushText
when you are finished converting all the text in a text stream.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECConvertTextToMultipleEncodings
Converts text in the source encoding to runs of text in multiple destination encodings. It uses the conversion path specified in the converter object you supply.
OSStatus TECConvertTextToMultipleEncodings ( TECObjectRef encodingConverter, ConstTextPtr inputBuffer, ByteCount inputBufferLength, ByteCount *actualInputLength, TextPtr outputBuffer, ByteCount outputBufferLength, ByteCount *actualOutputLength, TextEncodingRun outEncodingsBuffer[], ItemCount maxOutEncodingRuns, ItemCount *actualOutEncodingRuns );
Parameters
- encodingConverter
The reference to the text encoding converter object to be used for the conversion. This is the reference returned by the function
TECCreateOneToManyConverter.- inputBuffer
The stream of text to be converted.
- inputBufferLength
The length in bytes of the stream of text specified in the
inputBufferparameter.- actualInputLength
On return, a pointer to a the number of source text bytes that were converted.
- outputBuffer
On return, a pointer to a buffer that holds the converted text.
- outputBufferLength
The length in bytes of the
outputBufferparameter.- actualOutputLength
On return, a pointer to the number of bytes of the converted text returned in the
outputBufferparameter.- outEncodingsBuffer
An array of text encoding runs for output. Note that the actual byte size of this buffer should be
actualOutEncodingRuns * sizeof(TextEncodingRun).- maxOutEncodingRuns
The maximum number of runs that can fit in the
outEncodingsBufferarray.- actualOutEncodingRuns
On return, a pointer to the number of runs in
outEncodingsBufferarray.
Return Value
A result code. See “TEC Manager Result Codes.” If there is not enough memory available to convert the text when allocating internal buffers, the function returns the appropriate Memory Manager result code.
Discussion
For the function to return successfully, the output buffer you allocate must be large enough to accommodate the converted text. If the output buffer is too small to accommodate any converted text, the function will fail. For best results, you should follow these guidelines when you allocate an output buffer:
Base the buffer length on an estimate of the byte requirements of the destination encoding. Make sure you account for additional bytes needed by the destination encoding (for example, an escape sequence) in addition to the actual text.
Always allocate a buffer at least 32 bytes long.
If size is a concern, make sure the output buffer is at least large enough to hold a portion of the converted text. You can convert part of the text, then use the value of the
actualInputLengthparameter to identify the next byte to be taken and to determine how many bytes remain. To convert the remaining text, you simply call the function again with the remaining text and a new output buffer.If the destination encoding is a character encoding scheme—such as ISO-2022-JP, which begins in ASCII and switches to other coded character sets through limited combinations of escape sequences—then you need to allocate enough space to accommodate escape sequences that signal switches. ISO-2022-JP requires 3 to 5 bytes for an escape sequence preceding the 1-byte or 2-byte character it introduces. If you allocate a buffer that is less than 5 bytes, the
TECConvertTextfunction could fail, depending on the text being converted.
The Text Encoding Converter creates internal buffers that hold intermediate results for indirect conversions
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECCountAvailableSniffers
Counts and returns the number of sniffers available in all installed plug-ins.
OSStatus TECCountAvailableSniffers ( ItemCount *numberOfEncodings );
Parameters
- numberOfEncodings
On return, a pointer to the number of sniffers in all installed plug-ins. You can use this number to determine what size array to allocate for a parameter of the
TECGetAvailableSniffersfunction.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function counts every instance of a sniffer. If different
conversion plug-ins support a sniffer for the same encoding, the
sniffer is counted more than once. Since the TECGetAvailableSniffers function
ignores duplicate sniffers, TECCountAvailableSniffers may
return a number greater than the number of array elements needed
for the availableSniffers[] parameter
of the TECGetAvailableSniffers function.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECCountAvailableTextEncodings
Counts and returns the number of text encodings currently configured in the Text Encoding Converter.
OSStatus TECCountAvailableTextEncodings ( ItemCount *numberEncodings );
Parameters
- numberEncodings
On return, a pointer to the number of currently supported text encodings. You use this value to determine the array size for a parameter of the
TECGetAvailableTextEncodingsfunction.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
The number of text encodings includes every instance of a
text encoding. If different conversion plug-ins support the same
text encoding, the text encoding will be counted more than once.
For example, the Japanese Encodings plug-in supports Mac OS Japanese, and
so does the Unicode Encodings plug-in. Since the TECGetAvailableTextEncodings function
ignores duplicate text encoding specifications, TECCountAvailableTextEncodings may
return a number greater than the number of array elements needed
for the availableEncodings []
parameter.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECCountDestinationTextEncodings
Counts and returns the number of destination encodings to which a specified source encoding can be converted in one step.
OSStatus TECCountDestinationTextEncodings ( TextEncoding inputEncoding, ItemCount *numberOfEncodings );
Parameters
- inputEncoding
The text encoding specification describing the source text.
- numberOfEncodings
On return, a pointer to the number of text encodings to which the source encoding can be converted in one step. You should use this to determine how large to make the array you pass to the
TECGetDestinationTextEncodingsfunction.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function counts every instance of an encoding. If different conversion plug-ins support the same direct text encoding, the direct text encoding is counted more than once.
Since the TECGetDestinationTextEncodings function
ignores duplicate text encoding specifications, TECCountDestinationTextEncodings may
return a number greater than the number of array elements needed
for the destinationEncodings[] parameter.
Availability
- Available in OS X v10.0 and later.
Carbon Porting Notes
Declared In
TextEncodingConverter.hTECCountDirectTextEncodingConversions
Counts and returns the number of direct conversions currently configured in the Text Encoding Converter.
OSStatus TECCountDirectTextEncodingConversions ( ItemCount *numberOfEncodings );
Parameters
- numberOfEncodings
On return, a pointer to the number of direct conversions. You should use this value to determine the array size for a parameter of the
TECGetDirectTextEncodingConversionsfunction.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
The number of direct conversions includes every instance of a conversion. If different conversion plug-ins support the same direct conversion, the direct conversion is counted more than once.
Since the TECGetDirectTextEncodingConversions
function ignores duplicate direct conversions, TECCountDirectTextEncodingConversions may
return a number greater than the number of array elements needed
for the directConversions parameter.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECCountMailTextEncodings
Counts and returns the number of currently supported e-mail encodings for a specified region.
OSStatus TECCountMailTextEncodings ( RegionCode locale, ItemCount *numberEncodings );
Parameters
- locale
A Mac OS region code. A region code designates a combination of language, writing system, and geographic region; the region may not correspond to a particular country (for example, Swiss French or Arabic).
- numberEncodings
On return, a pointer to the number of currently supported e-mail encodings for the region code. You use this number to determine what size array to allocate for a parameter of the
TECGetMailTextEncodingsfunction.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function counts every instance of an encoding. If different
conversion plug-ins support the same direct text encoding, the direct
text encoding is counted more than once. Since the TECGetMailTextEncodings function
ignores duplicate text encoding specifications, TECCountMailTextEncodings may
return a number greater than the number of array elements needed.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECCountSubTextEncodings
Counts and returns the number of subencodings a text encoding supports.
OSStatus TECCountSubTextEncodings ( TextEncoding inputEncoding, ItemCount *numberOfEncodings );
Parameters
- inputEncoding
The text encoding specification that contains the subencodings.
- numberOfEncodings
On return, a pointer to the number of currently supported subencodings. You use this value to determine the array size for a parameter of the
TECGetSubTextEncodingsfunction.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
Subencodings are text encodings that are embedded as part of a larger text encoding specification. For example, EUC-JP contains JIS Roman or ASCII, JIS X0208, JIS X0212, and half-width Katakana from JIS X0201. Not every encoding that can be broken into multiple encodings necessarily supports this routine. It’s up to the plug-in developer to decide which encodings might be useful to break up. Subencodings are not the same as text encoding variants.
If an encoding can be converted to multiple runs of encodings
(as indicated by a destination base encoding of kTextEncodingMultiRun),
you can call the TECGetSubTextEncodings function
to get the list of output encodings. See the TECCreateOneToManyConverter and TECGetDestinationTextEncodings
functions for information.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECCountWebTextEncodings
Counts and returns the number of currently supported text encodings for a region code.
OSStatus TECCountWebTextEncodings ( RegionCode locale, ItemCount *numberEncodings );
Parameters
- locale
A Mac OS region code indicating the locale for which you want to count encodings. A region code designates a combination of language, writing system, and geographic region; the region may not correspond to a particular country (for example, Swiss French or Arabic).
- numberEncodings
On return, a pointer to the number of currently supported text encodings for a region code. You should use this number to determine how large to make the array you pass to the
TECGetWebTextEncodingsfunction.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function counts every instance of the same encoding.
That is, if different conversion plug-ins support the same text
encoding for a conversion process, the text encoding is counted
more than once. Since the TECGetWebTextEncodings function
ignores duplicate text encoding specifications, TECCountWebTextEncodings may
return a number greater than the number of array elements needed
for the availableEncodings[] parameter.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECCreateConverter
Determines a conversion path for a source and destination encoding, then creates a text encoding converter object and returns a pointer to it.
OSStatus TECCreateConverter ( TECObjectRef *newEncodingConverter, TextEncoding inputEncoding, TextEncoding outputEncoding );
Parameters
- newEncodingConverter
A pointer to a converter object. On return, this reference points to a newly created text converter object.
- inputEncoding
The text encoding specification for the source text encoding.
- outputEncoding
The text encoding specification for the destination text encoding.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You use this converter object reference with conversion functions
such as TECConvertText to
convert text. This converter object describes the source, destination,
and intermediate encodings; state information; and references to
required plug-ins.
If the function does not find a direct conversion path, it
creates an indirect conversion path. You can use the function TECCreateConverterFromPath
to specify an explicit conversion path.
You must use the TECDisposeConverter
function to remove a converter object.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECCreateConverterFromPath
Creates a converter object for a specific conversion path—from a source encoding through intermediate encodings to a destination encoding—and returns a pointer to it.
OSStatus TECCreateConverterFromPath ( TECObjectRef *newEncodingConverter, const TextEncoding inPath[], ItemCount inEncodings );
Parameters
- newEncodingConverter
A pointer to a converter object reference. On return, the reference points to a newly created text converter object.
- inPath
An ordered array of text encoding specifications, beginning with the source encoding specification and ending with the destination encoding specification. Each adjacent pair of text encodings must represent a conversion that is supported by the Text Encoding Converter.
- inEncodings
The number of text encoding specifications in the
inPatharray.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function is faster than the function TECCreateConverter since it does not
need to search for a conversion path. You can use the TECGetDestinationTextEncodings
function to determine each step in the sequence from the source
to the destination encoding.
To remove a converter object, you must call the function TECDisposeConverter.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECCreateOneToManyConverter
Determines a conversion path for the source encoding and destinations encodings you specify, creates a text encoding converter object, and returns a reference to it.
OSStatus TECCreateOneToManyConverter ( TECObjectRef *newEncodingConverter, TextEncoding inputEncoding, ItemCount numOutputEncodings, const TextEncoding outputEncodings[] );
Parameters
- newEncodingConverter
A pointer to a converter object. On return, this points to a newly created one-to-many converter object.
- inputEncoding
The text encoding specification for the source text encoding.
- numOutputEncodings
The number of text encoding specifications in the
outputEncodingarray.- outputEncodings
An ordered array of text encoding specifications for the destination text encodings.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You use this converter object reference with conversion functions
such as TECConvertTextToMultipleEncodings.
The converter object describes the source, destination, and intermediate
encodings; state information; and references to required plug-ins.
To remove a converter object, you must call the function TECDisposeConverter.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECCreateSniffer
Creates a sniffer object and returns a reference to it.
OSStatus TECCreateSniffer ( TECSnifferObjectRef *encodingSniffer, TextEncoding testEncodings[], ItemCount numTextEncodings );
Parameters
- encodingSniffer
A pointer to a sniffer object reference, which is of type
TECSnifferObjectRef. On return, the reference pertains to the newly created sniffer object.- testEncodings
An array of text encoding specifications supplied by the caller;
TECCreateSniffercreates a sniffer that can detect each of these encodings.- numTextEncodings
The number of text encoding specifications in the
testEncodings[]array.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
The TECCreateSniffer function
polls plug-ins for available sniffers, creates a sniffer object capable
of sniffing each of the specified encodings that it can find a sniffer
function for, and returns a reference to it. You use this sniffer
object reference with sniffer functions such as TECSniffTextEncoding. If no sniffer
function is available for an encoding, no error is returned and TECSniffTextEncoding indicates
later that the encoding was not examined.
To remove a sniffer object, you must call the function TECDisposeSniffer.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECDisposeConverter
Disposes of a converter object.
OSStatus TECDisposeConverter ( TECObjectRef newEncodingConverter );
Parameters
- newEncodingConverter
A reference to the text encoding converter object you want to remove. This can be the reference returned by the
TECCreateConverter,TECCreateConverterFromPath, orTECCreateOneToManyConverterfunctions.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
If you want to reuse the converter object for a different
text stream with the same source and destination encoding, you should
clear the converter object using the TECClearConverterContextInfo function
rather than disposing of it and then creating a new converter object.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECDisposeSniffer
Disposes of a sniffer object.
OSStatus TECDisposeSniffer ( TECSnifferObjectRef encodingSniffer );
Parameters
- encodingSniffer
The sniffer object reference you want to remove.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function releases all memory allocated to the sniffer
object created by the TECCreateSniffer
function.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECFlushMultipleEncodings
Flushes out any encodings that may be stored in a converter object’s temporary buffers and shifts encodings back to their default state, if any.
OSStatus TECFlushMultipleEncodings ( TECObjectRef encodingConverter, TextPtr outputBuffer, ByteCount outputBufferLength, ByteCount *actualOutputLength, TextEncodingRun outEncodingsBuffer[], ItemCount maxOutEncodingRuns, ItemCount *actualOutEncodingRuns );
Parameters
- encodingConverter
The reference to the text encoding converter object whose contents are to be flushed. This is the reference returned by the function
TECCreateOneToManyConverter.- outputBuffer
On return, a pointer to a buffer that holds the converted text. An error is returned is the buffer is not large enough to hold the entire converted text stream.
- outputBufferLength
The length in bytes of the
outputBufferparameter.- actualOutputLength
On return, a pointer to a the actual number of bytes of the converted text returned in the
outputBufferparameter.- outEncodingsBuffer
An ordered array of text encoding runs for the destination text encoding. Note that the actual byte size of this buffer should be
actualOutEncodingRuns * sizeof(TextEncodingRun).- maxOutEncodingRuns
The maximum number of encoding runs that can fit in
outEncodingsBuffer[].- actualOutEncodingRuns
On return, a pointer to a the number of runs in the buffer during conversion.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You should always call TECFlushMultipleEncodings at
the end of the conversion process to flush out any data that may
be stored in the temporary buffers of the text encoding converter
object or to perform other end-of-encoding conversion tasks. Encodings
such as ISO-2022-JP are reset to a default state when you use this
function.
For the function to return successfully, the output buffer you allocate must be large enough to accommodate the converted text. If the output buffer is too small to accommodate any converted text, the function will fail. For best results, you should follow these guidelines when you allocate an output buffer:
Base the buffer length on an estimate of the byte requirements of the destination encoding. Make sure you account for additional bytes needed by the destination encoding (for example, an escape sequence) in addition to the actual text.
Always allocate a buffer at least 32 bytes long.
If size is a concern, make sure the output buffer is at least large enough to hold a portion of the converted text. You can convert part of the text, then use the value of the
actualInputLengthparameter to identify the next byte to be taken and to determine how many bytes remain. To convert the remaining text, you simply call the function again with the remaining text and a new output buffer.If the destination encoding is a character encoding scheme—such as ISO-2022-JP, which begins in ASCII and switches to other coded character sets through limited combinations of escape sequences—then you need to allocate enough space to accommodate escape sequences that signal switches. ISO-2022-JP requires 3 to 5 bytes for an escape sequence preceding the 1-byte or 2-byte character it introduces. If you allocate a buffer that is less than 5 bytes, the
TECConvertTextfunction could fail, depending on the text being converted.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECFlushText
Flushes out any data in a converter object’s temporary buffers and resets the converter object.
OSStatus TECFlushText ( TECObjectRef encodingConverter, TextPtr outputBuffer, ByteCount outputBufferLength, ByteCount *actualOutputLength );
Parameters
- encodingConverter
A reference to the text converter object whose contents are to be flushed. This can be a reference returned by the
TECCreateConverterorTECCreateConverterFromPathfunctions.- outputBuffer
On return, a pointer to a buffer that holds the converted text.
- outputBufferLength
The length in bytes of the buffer provided by the
outputBufferparameter.- actualOutputLength
On return, a pointer to the number of bytes of converted text returned in the buffer specified by the
outputBufferparameter.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
You should always call TECFlushText when
you finish converting a text stream. If you are converting a single
stream in multiple chunks using multiple calls to TECConvertText,
you only need to call TECFlushText after
the last call to TECConvertText for
that stream. The function uses the conversion path specified in
the converter object you supply.
For the function to return successfully, the output buffer you allocate must be large enough to accommodate the flushed text. If the output buffer is too small to accommodate any flushed text, the function will fail. For best results, you should follow these guidelines when you allocate an output buffer:
Base the buffer length on an estimate of the byte requirements of the destination encoding. Make sure you account for additional bytes needed by the destination encoding (for example, an escape sequence) in addition to the actual text.
Always allocate a buffer at least 32 bytes long.
Encodings such as ISO-2022 that need to shift back to a certain default state at the end of a conversion can do so when this function is called.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECGetAvailableSniffers
Returns the list of sniffers available in all installed plug-ins.
OSStatus TECGetAvailableSniffers ( TextEncoding availableSniffers[], ItemCount maxAvailableSniffers, ItemCount *actualAvailableSniffers );
Parameters
- availableSniffers
On return, an array of text encoding specifications that the available sniffers currently support. You should use the
TECCountAvailableSniffersfunction to determine what size array to allocate.- maxAvailableSniffers
The number of text encoding specifications the
availableSniffersarray can contain.- actualAvailableSniffers
On return, a pointer to the number of text encodings in the
availableSniffersarray.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function ignores duplicate text encoding specifications.
If you used the TECCountAvailableSniffers
function to determine the size of the TECGetAvailableSniffers array,
the number of available encodings may be fewer than the number of
array elements, because TECCountAvailableSniffers includes
duplicate text encoding specifications in its count.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECGetAvailableTextEncodings
Returns the text encoding specifications currently configured in the Text Encoding Converter.
OSStatus TECGetAvailableTextEncodings ( TextEncoding availableEncodings[], ItemCount maxAvailableEncodings, ItemCount *actualAvailableEncodings );
Parameters
- availableEncodings
On return, an array of text encoding specifications. You should use the
TECCountAvailableTextEncodingsfunction to determine what size array to allocate.- maxAvailableEncodings
The number of text encoding specifications the
availableEncodingsarray can contain.- actualAvailableEncodings
On return, a pointer to the number of text encodings returned in the
availableEncodingsarray.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function ignores duplicate text encoding specifications.
If you used the TECCountAvailableTextEncodings
function to determine the size of the availableEncodings []
array, the number of encodings may be fewer than the number of array
elements, because TECCountAvailableTextEncodings includes
duplicate text encodings in its count.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECGetDestinationTextEncodings
Returns the encoding specifications for all the destination text encodings to which the Text Encoding Converter can directly convert the specified source encoding.
OSStatus TECGetDestinationTextEncodings ( TextEncoding inputEncoding, TextEncoding destinationEncodings[], ItemCount maxDestinationEncodings, ItemCount *actualDestinationEncodings );
Parameters
- inputEncoding
The text encoding specification describing the source text.
- destinationEncodings
On return, an array of specifications for the destination encodings to which the converter can directly convert the source encoding. You should use the
TECCountDestinationTextEncodingsfunction to determine how large an array to allocate.- maxDestinationEncodings
The maximum number of destination text encodings that the array can contain.
- actualDestinationEncodings
On return, a pointer to the number of text encoding specifications in the destination encodings array.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function ignores duplicate direct text encoding specifications.
If you used the TECCountDestinationTextEncodings
function to determine the size of the destinationEncodings[] array,
the number of available encodings may be fewer than the number of
array elements, because TECCountDestinationTextEncodings includes
duplicates in its count.
You can display the names of these destination encodings to the user.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECGetDirectTextEncodingConversions
Returns the types of direct conversions currently configured in the Text Encoding Converter.
OSStatus TECGetDirectTextEncodingConversions ( TECConversionInfo availableConversions[], ItemCount maxAvailableConversions, ItemCount *actualAvailableConversions );
Parameters
- availableConversions
An array composed of text encoding conversion information structures, each of which specifies a set of source and destination encodings for a type of conversion. See
TECConversionInfofor more information. You should use theTECGetDirectTextEncodingConversionsfunction to determine how large to make the array.- maxAvailableConversions
The maximum number of text encoding conversion information structures that the
directConversionsarray can contain.- actualAvailableConversions
On return, a pointer to the number of text encoding conversion information structures returned in the
directConversionsarray.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function ignores duplicate text encoding conversion information
structures. If you used the TECCountDirectTextEncodingConversions
function to determine the size of the directConversions[] array,
the number of text encoding conversion information structures may
be fewer than the number of array elements, because TECCountDirectTextEncodingConversions counts
duplicate text encoding conversion information structures.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECGetEncodingList
Gets the list of destination encodings from a converter object.
OSStatus TECGetEncodingList ( TECObjectRef encodingConverter, ItemCount *numEncodings, Handle *encodingList );
Parameters
- encodingConverter
A reference to the text encoding conversion object returned by the
TECCreateOneToManyConverterfunction.- numEncodings
On return, a pointer to the number of encodings specified by the
encodingListhandle.- encodingList
A handle to an array of text encoding specifications. On return, it contains an array of text encoding specifications to which the converter object can convert. The memory for the array is allocated automatically by the Text Encoding Converter.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
The TECDisposeConverter function
automatically disposes of the pointer for you. This means you should
not reference the pointer after you have disposed of the converter object.
Plug-ins that perform one-to-many conversions use the TECGetEncodingList function
to get the output encoding list from the converter object reference.
Availability
- Available in OS X v10.0 and later.
Carbon Porting Notes
Declared In
TextEncodingConverter.hTECGetInfo
Allocates a converter information structure of type TECInfo in
the application heap using NewHandle,
fills it out, and returns a handle.
OSStatus TECGetInfo ( TECInfoHandle *tecInfo );
Parameters
- tecInfo
A handle to a structure of type
TECInfocontaining information about the converter.
Return Value
A result code. See “TEC Manager Result Codes.” This function can return memory errors.
Discussion
When you are finished with the handle, your application must
dispose of it using DisposeHandle.
You must also perform any required preflighting or memory rearrangement
before calling TECGetInfo.
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hTECGetMailTextEncodings
Returns the currently supported mail encoding specifications for a region code.
OSStatus TECGetMailTextEncodings ( RegionCode locale, TextEncoding availableEncodings[], ItemCount maxAvailableEncodings, ItemCount *actualAvailableEncodings );
Parameters
- locale
A Mac OS region code. A region code designates a combination of language, writing system, and geographic region; the region may not correspond to a particular country (for example, Swiss French or Arabic).
- availableEncodings
An array of text encoding specifications. On return, the array contains specifications for the e-mail text encodings for a region code. You should use the function
TECCountMailTextEncodingsfunction to determine what size array to allocate.- maxAvailableEncodings
The number of text encoding specifications the
availableEncodingsarray can contain.- actualAvailableEncodings
On return, a pointer to the number of text encodings in the
availableEncodingsarray.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function ignores duplicate text encoding specifications.
If you used the TECCountMailTextEncodings
function to determine the size of the availableEncodings[] array
the number of available encodings may be fewer than the number of
array elements, because TECCountMailTextEncodings includes
duplicate text encoding specifications in its count.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECGetSubTextEncodings
Returns the text encoding specifications for the subencodings the encoding scheme supports.
OSStatus TECGetSubTextEncodings ( TextEncoding inputEncoding, TextEncoding subEncodings[], ItemCount maxSubEncodings, ItemCount *actualSubEncodings );
Parameters
- inputEncoding
A text encoding specification.
- subEncodings
On return, the array contains the specifications for the subencodings of the
inputEncodingparameter. You should use the functionTECCountSubTextEncodingsfunction to determine what size an array to allocate.- maxSubEncodings
The number of text encoding specifications the
subEncodingsarray can contain.- actualSubEncodings
On return, a pointer to number of subencodings in the
subEncodingsarray.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
Subencodings are text encodings that are embedded as part of a larger text encoding specification. For example, EUC-JP contains JIS Roman or ASCII, JIS X0208, JIS X0212, and half-width Katakana from JIS X0201. Not every encoding that can be broken into multiple encodings necessarily supports this routine. It’s up to the plug-in developer to decide which encodings might be useful to break up. Subencodings are not the same as text encoding variants
If an encoding can be converted to multiple runs of encodings
(as indicated by a destination base encoding of kTextEncodingMultiRun),
you can call the TECGetSubTextEncodings
function to get the list of output encodings. See the TECCreateOneToManyConverter
and TECGetDestinationTextEncodings
functions for information about multiple output encoding run conversions.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECGetTextEncodingFromInternetName
Returns the Mac OS text encoding specification that corresponds to an Internet encoding name.
OSStatus TECGetTextEncodingFromInternetName ( TextEncoding *textEncoding, ConstStr255Param encodingName );
Parameters
- textEncoding
On return, a pointer to a structure that contains a Mac OS text encoding specification.
- encodingName
An Internet encoding name, in 7-bit US ASCII.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
Internet encoding names are stored as strings, while the Text Encoding Converter uses numeric values.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECGetTextEncodingInternetName
Returns the Internet encoding name that corresponds to a Mac OS text encoding.
OSStatus TECGetTextEncodingInternetName ( TextEncoding textEncoding, Str255 encodingName );
Parameters
- textEncoding
A Mac OS text encoding specification.
- encodingName
On return, the Internet encoding name, in 7-bit US ASCII. If there are several Internet encoding names for the same text encoding, the
encodingNameparameter contains the preferred name.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECGetWebTextEncodings
Returns the currently supported text encoding specifications for a region code.
OSStatus TECGetWebTextEncodings ( RegionCode locale, TextEncoding availableEncodings[], ItemCount maxAvailableEncodings, ItemCount *actualAvailableEncodings );
Parameters
- locale
A Mac OS region code. A region code designates a combination of language, writing system, and geographic region and may not correspond to a particular country (for example, Swiss French or Arabic).
- availableEncodings
On return, an array that contains specifications for the currently supported text encodings in the specified region. You should use the
TECCountWebTextEncodingsfunction to determine how large an array to allocate.- maxAvailableEncodings
The number of text encodings specifications the
availableEncodingsarray can contain.- actualAvailableEncodings
On return, a pointer to the number of text encodings specifications in the
availableEncodingsarray.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
This function ignores duplicate text encoding specifications.
If you used the TECCountWebTextEncodings
function to determine the size of the availableEncodings[] array
the number of available encodings may be fewer than the number of
array elements, because TECCountWebTextEncodings includes
duplicate text encoding specifications in its count.
You can use the list of available encodings to create an encoding selection menu for a Web browser.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECSniffTextEncoding
Analyzes a text stream and returns the probable encodings in a ranked list, based on an array of possible encodings you supply. It also returns the number of errors and features for each encoding.
OSStatus TECSniffTextEncoding ( TECSnifferObjectRef encodingSniffer, ConstTextPtr inputBuffer, ByteCount inputBufferLength, TextEncoding testEncodings[], ItemCount numTextEncodings, ItemCount numErrsArray[], ItemCount maxErrs, ItemCount numFeaturesArray[], ItemCount maxFeatures );
Parameters
- encodingSniffer
A reference to a sniffer object.
- inputBuffer
The text to be sniffed.
- inputBufferLength
The length of the input buffer.
- testEncodings
An array of text encoding specifications. You must fill the array with the text encodings for which you want to sniff. On output, the array elements are reordered from the most likely to the least likely text encodings.
- numTextEncodings
The number of entries in the
testEncodings[]parameter.- numErrsArray
An array that must contain at least
numTextEncodingselements. On return, an array of the number of errors found for each possible text encoding. The array elements are in the same order as thetestEncodings[]array elements at output.- maxErrs
The maximum number of errors a sniffer can encounter. The sniffer stops looking for an encoding after this number is reached.
- numFeaturesArray
An array of that must contain at least
numTextEncodingselements. On return, an array of the number of features found for each possible text encoding. The array elements are in the same order as thetestEncodings[]array elements at output.- maxFeatures
The maximum number of features a sniffer can encounter. The sniffer stops looking for a features after this number is reached.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
An error indicates a code point or sequence that is illegal in the specified encoding. A feature indicates the presence of a sequence that is characteristic of that encoding.
For example, the byte sequence which is interpreted in Mac OS Roman as “é” could legally be interpreted either as Mac OS Roman text or as Mac OS Japanese text. Both sniffers would return zero errors, but the Mac OS Japanese sniffer would also return two features of Mac OS Japanese (representing two legal 2-byte characters.)
The arrays are returned in a ranked list with the most likely
text encodings first. The results are sorted first by number of
errors (fewest to most), then by number of features (most to fewest),
and then by the original order in the list. On return, the most
likely encoding is in testEncodings[0] or testEncodings[1].
If an encoding is not examined, its number of errors and features are set to 0xFFFFFFFF, and the encoding is sorted to the end of the list.
Availability
- Available in OS X v10.0 and later.
Carbon Porting Notes
Declared In
TextEncodingConverter.hTruncateForTextToUnicode
Identifies where your application can safely break a multibyte string to be converted to Unicode so that the string is not broken in the middle of a multibyte character.
OSStatus TruncateForTextToUnicode ( ConstTextToUnicodeInfo iTextToUnicodeInfo, ByteCount iSourceLen, ConstLogicalAddress iSourceStr, ByteCount iMaxLen, ByteCount *oTruncatedLen );
Parameters
- iTextToUnicodeInfo
The Unicode converter object of type
TextToUnicodeInfofor the text string to be divided up with each segment properly truncated. TheTruncateForTextToUnicodefunction does not modify the object’s contents.- iSourceLen
The length in bytes of the multibyte string to be divided up.
- iSourceStr
The address of the multibyte string to be divided up.
- iMaxLen
The maximum allowable length of the string to be truncated. This must be less than or equal to
iSourceLen.- oTruncatedLen
A pointer to a value of type
ByteCount. On return, this value contains the length of the longest portion of the multibyte string, pointed to byiSourceStr, that is less than or equal to the length specified byiMaxLen. This identifies the byte after which you can break the string.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
Your application can use this function to break a string properly
before you call the function ConvertFromTextToUnicode
so that the string you pass it is terminated with complete characters.
You can call this function repeatedly to properly divide up a text segment,
each time identifying the new beginning of the string, until the
last portion of the text is less than or equal to the maximum allowable
length. Each time you use the function, you get a properly terminated
string within the allowable length range.
Because the TruncateForTextToUnicode function
does not modify the contents of the Unicode converter object, you
can call this function safely between calls to the function ConvertFromTextToUnicode.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hTruncateForUnicodeToText
Identifies where your application can safely break a Unicode string to be converted to any encoding so that the string is broken in a way that preserves the text element integrity.
OSStatus TruncateForUnicodeToText ( ConstUnicodeToTextInfo iUnicodeToTextInfo, ByteCount iSourceLen, const UniChar iSourceStr[], OptionBits iControlFlags, ByteCount iMaxLen, ByteCount *oTruncatedLen );
Parameters
- iUnicodeToTextInfo
A Unicode converter object
UnicodeToTextInfofor the Unicode string to be divided up. TheTruncateForUnicodeToTextfunction does not modify the contents of this private structure.- iSourceLen
The length in bytes of the Unicode string to be divided up.
- iSourceStr
A pointer to the Unicode string to be divided up.
- iControlFlags
Truncation control flags. Specify the flag
kUnicodeStringUnterminatedMaskif truncating a buffer of text that belongs to a longer stream containing a subsequent buffer of text that could have characters belonging to a text element that begins at the end of the current buffer. If you set this flag, typically you would set theiMaxLenparameter equal toiSourceLen.- iMaxLen
The maximum allowable length of the string to be truncated. This must be less than or equal to
iSourceLen.- oTruncatedLen
A pointer to a value of type
ByteCount. On return, this value contains the length of the longest portion of the Unicode source string, pointed to by theiSourceStrparameter, that is less than or equal to the value of theiMaxLenparameter. This returned parameter identifies the byte after which you can truncate the string.
Return Value
A result code. See “TEC Manager Result Codes.”
Discussion
Your application can use this function to divide up a Unicode
string properly truncating each portion before you call ConvertFromUnicodeToText or ConvertFromUnicodeToScriptCodeRun to
convert the string. You can call this function repeatedly to properly
truncate a text segment, each time identifying the new beginning
of the string, until the last portion of the text is less than or
equal to the maximum allowable length. Each time you use the function,
you get a properly terminated string within the allowable length
range.
Because this function does not modify the contents of the Unicode converter object, you can call this function between conversion calls.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hUCGetCharProperty
Obtains the value associated with a property type for
the specified UniChar characters.
OSStatus UCGetCharProperty ( const UniChar *charPtr, UniCharCount textLength, UCCharPropertyType propType, UCCharPropertyValue *propValue );
Parameters
- charPtr
A pointer to the Unicode text whose property value you want to obtain.
- textLength
The length of the text pointed to by
charPtr.- propType
The property type for the
UniCharcharacter whose value you want to obtain. See “Unicode Character Property Types” for a list of the constants you can supply.- propValue
On return, the value associated with the property type specified by the
propTypeparameter. See “Unicode Character Property Values” for a list of the constants that can be returned.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hUpgradeScriptInfoToTextEncoding
Converts any combination of a Mac OS script code, a language code, a region code, and a font name to a text encoding.
OSStatus UpgradeScriptInfoToTextEncoding ( ScriptCode iTextScriptID, LangCode iTextLanguageID, RegionCode iRegionID, ConstStr255Param iTextFontname, TextEncoding *oEncoding );
Parameters
- iTextScriptID
A valid Script Manager script code. The Mac OS Script Manager defines constants for script codes using this format:
smXxx. To designate the system script, specify the meta-value ofsmSystemScript. To designate the current script based on the font specified in the graphics port (grafPort), specify the metavalue ofsmCurrentScript. To indicate that you do not want to provide a script code for this parameter, specify the constantkTextScriptDontCare.- iTextLanguageID
A valid Script Manager language code. The Mac OS Script Manager defines constants for language codes using this format:
langXxx. To indicate that you do not want to provide a language code for this parameter, specify the constantkTextLanguageDontCare.- iRegionID
A valid Script Manager region code. The Mac OS Script Manager defines constants for region codes using this format:
verXxx. To indicate that you do not want to provide a region code for this parameter, specify the constantkTextRegionDontCare.- iTextFontname
The name of a font associated with a particular text encoding specification, such as Symbol or Zapf Dingbats, or the name of any font that is currently installed on the system. To indicate that you do not want to provide a font name, specify a value of
NULL.- oEncoding
A pointer to a value of type
TextEncoding. On return, this value holds the text encoding specification that the function created from the other values you provided.
Return Value
A result
code. See “TEC Manager Result Codes.” This function returns paramErr if
two or more of the input parameter values conflict in some way—for
example, the Mac OS language code does not belong to the script whose
script code you specified, or if the input parameter values are invalid.
The function returns a kTECTableFormatErr result
code if the internal mapping tables used for translation are invalid.
Discussion
The UpgradeScriptInfoToTextEncoding function
allows you to derive a text encoding specification from script codes,
language codes, region codes, and font names. A one-to-one correspondence
exists between many of the Script Manager’s script codes and a
particular Mac OS text encoding base value. However, because text
encodings are a superset of script codes, some combinations of script
code, language code, region code, and font name might result in
a different text encoding base value than would be the case if the
translation were based on the script code alone.
When you call the UpgradeScriptInfoToTextEncoding function,
you can specify any combination of its parameters, but you must
specify at least one.
If you don’t specify an explicit value for a script, language,
or region code parameter, you must pass the do-not-care constant
appropriate to that parameter. If you do not specify an explicit
value for iTextFontName,
you must pass NULL. UpgradeScriptInfoToTextEncoding uses
as much information as you supply to determine the equivalent text
encoding or the closest approximation. If you provide more than
one parameter, all parameters are checked against one another to
ensure that they are valid in combination.
A font name, such as 'Symbol' or 'Zapf
Dingbats,' can indicate a particular text
encoding base. Other font names can indicate particular variants
associated with a particular text encoding base. Otherwise, the
font name is used to obtain a script code, and this script code will
be checked against any script code you supply (in this case, the
font must be installed; if it is not, the function returns a paramErr result
code). If you do not supply either a language code or a region code
and the script code you supply or the one that is derived matches
the system script, then the system’s localization is used to determine
the appropriate region and language code. This is used for deriving
text encoding base values that depend on region and language, such
as kTextEncodingMacTurkish.
For more information see the RevertTextEncodingToScriptInfo function
and “Base Text Encodings.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hCallbacks by Task
Setting Up a Fallback Handler
Setting Up a TEC Plug-in
-
TECPluginGetPluginDispatchTablePtr -
TECPluginNewEncodingConverterPtr -
TECPluginClearContextInfoPtr -
TECPluginConvertTextEncodingPtr -
TECPluginFlushConversionPtr -
TECPluginDisposeEncodingConverterPtr -
TECPluginNewEncodingSnifferPtr -
TECPluginClearSnifferContextInfoPtr -
TECPluginSniffTextEncodingPtr -
TECPluginDisposeEncodingSnifferPtr -
TECPluginGetCountAvailableTextEncodingsPtr -
TECPluginGetCountAvailableTextEncodingPairsPtr -
TECPluginGetCountDestinationTextEncodingsPtr -
TECPluginGetCountSubTextEncodingsPtr -
TECPluginGetCountAvailableSniffersPtr -
TECPluginGetCountWebEncodingsPtr -
TECPluginGetCountMailEncodingsPtr -
TECPluginGetTextEncodingInternetNamePtr -
TECPluginGetTextEncodingFromInternetNamePtr
Callbacks
TECPluginClearContextInfoPtr
Defines a pointer to a function that resets a converter object to its initial state.
typedef OSStatus (*TECPluginClearContextInfoPtr) ( TECObjectRef encodingConverter, TECConverterContextRec * plugContext );
If you name your function MyTECPluginClearContextInfo,
you would declare it like this:
OSStatus MyTECPluginClearContextInfoPtr ( TECObjectRef encodingConverter, TECConverterContextRec * plugContext );
Parameters
- encodingConverter
A reference to the text encoding converter object that needs to be reset.
- plugContext
A pointer to a TEC converter context record.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginClearSnifferContextInfoPtr
Defines a pointer to a function that resets a sniffer object to its initial settings.
typedef OSStatus (*TECPluginClearSnifferContextInfoPtr) ( TECSnifferObjectRef encodingSniffer, TECSnifferContextRec * snifContext );
If you name your function MyTECPluginClearSnifferContextInfo,
you would declare it like this:
OSStatus MyTECPluginClearSnifferContextInfoPtr ( TECSnifferObjectRef encodingSniffer, TECSnifferContextRec * snifContext );
Parameters
- encodingSniffer
A reference to the sniffer object that needs to be reset.
- snifContext
A pointer to a TEC sniffer context record.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginConvertTextEncodingPtr
Defines a pointer to a function that converts stream of text from a source encoding to a destination encoding, using the conversion path specified by the converter object you supply.
typedef OSStatus (*TECPluginConvertTextEncodingPtr) ( TECObjectRef encodingConverter, TECConverterContextRec * plugContext );
If you name your function MyTECPluginConvertTextEncoding,
you would declare it like this:
OSStatus MyTECPluginConvertTextEncodingPtr ( TECObjectRef encodingConverter, TECConverterContextRec * plugContext );
Parameters
- encodingConverter
A reference to the text encoding converter object to use for the conversion.
- plugContext
A pointer to a TEC converter context record that contains the text and other information needed for the conversion.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginDisposeEncodingConverterPtr
Defines a pointer to a function that disposes of a converter object.
typedef OSStatus (*TECPluginDisposeEncodingConverterPtr) ( TECObjectRef newEncodingConverter, TECConverterContextRec * plugContext );
If you name your function MyTECPluginDisposeEncodingConverter,
you would declare it like this:
OSStatus MyTECPluginDisposeEncodingConverterPtr ( TECObjectRef newEncodingConverter, TECConverterContextRec * plugContext );
Parameters
- newEncodingConverter
A reference to the converter object to dispose of.
- plugContext
A pointer to a TEC converter context record.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginDisposeEncodingSnifferPtr
Defines a pointer to a function that disposes of a sniffer object.
typedef OSStatus (*TECPluginDisposeEncodingSnifferPtr) ( TECSnifferObjectRef encodingSniffer, TECSnifferContextRec * snifContext );
If you name your function MyTECPluginDisposeEncodingSniffer,
you would declare it like this:
OSStatus MyTECPluginDisposeEncodingSnifferPtr ( TECSnifferObjectRef encodingSniffer, TECSnifferContextRec * snifContext );
Parameters
- encodingSniffer
A reference to the sniffer object you want to dispose.
- snifContext
A pointer to a TEC sniffer context record.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginFlushConversionPtr
Defines a pointer to a function that flushes out any data in a converter object’s temporary buffers and resets the converter object.
typedef OSStatus (*TECPluginFlushConversionPtr) ( TECObjectRef encodingConverter, TECConverterContextRec * plugContext );
If you name your function MyTECPluginFlushConversion,
you would declare it like this:
OSStatus MyTECPluginFlushConversionPtr ( TECObjectRef encodingConverter, TECConverterContextRec * plugContext );
Parameters
- encodingConverter
A reference to the text converter object whose contents are to be flushed.
- plugContext
A pointer to a TEC converter context record.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginGetCountAvailableSniffersPtr
Defines a pointer to a function that counts and returns the number of sniffers available in all installed plug-ins.
typedef OSStatus (*TECPluginGetCountAvailableSniffersPtr) ( TextEncoding * availableEncodings, ItemCount maxAvailableEncodings, ItemCount * actualAvailableEncodings );
If you name your function MyTECPluginGetCountAvailableSniffers,
you would declare it like this:
OSStatus MyTECPluginGetCountAvailableSniffersPtr ( TextEncoding * availableEncodings, ItemCount maxAvailableEncodings, ItemCount * actualAvailableEncodings );
Parameters
- availableEncodings
On return, a pointer to the currently available sniffer text encoding specifications.
- maxAvailableEncodings
The number of text encoding specifications the
availableEncodingsarray can contain.- actualAvailableEncodings
On the return, the number of text encoding specifications the
availableEncodingsarray actually contains.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginGetCountAvailableTextEncodingPairsPtr
Defines a pointer to a function that obtains the available text encoding pairs.
typedef OSStatus (*TECPluginGetCountAvailableTextEncodingPairsPtr) ( TECConversionInfo * availableEncodings, ItemCount maxAvailableEncodings, ItemCount * actualAvailableEncodings );
If you name your function MyTECPluginGetCountAvailableTextEncodingPairs,
you would declare it like this:
OSStatus MyTECPluginGetCountAvailableTextEncodingPairsPtr ( TECConversionInfo * availableEncodings, ItemCount maxAvailableEncodings, ItemCount * actualAvailableEncodings );
Parameters
- availableEncodings
On return, an array of text encoding conversion information structures, each of which specifies a set of source and destination encodings for a type of conversion.
- maxAvailableEncodings
The number of text encoding information structures the
availableEncodingsarray can contain.- actualAvailableEncodings
On the return, the number of text encoding information structures the
availableEncodingsarray actually contains.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginGetCountAvailableTextEncodingsPtr
Defines a pointer to a function that obtains the available text encodings.
typedef OSStatus (*TECPluginGetCountAvailableTextEncodingsPtr) ( TextEncoding * availableEncodings, ItemCount maxAvailableEncodings, ItemCount * actualAvailableEncodings );
If you name your function MyTECPluginGetCountAvailableTextEncodings,
you would declare it like this:
OSStatus MyTECPluginGetCountAvailableTextEncodingsPtr ( TextEncoding * availableEncodings, ItemCount maxAvailableEncodings, ItemCount * actualAvailableEncodings );
Parameters
- availableEncodings
On return, a pointer to the currently available text encoding specifications.
- maxAvailableEncodings
The number of text encoding specifications the
availableEncodingsarray can contain.- actualAvailableEncodings
On the return, the number of text encoding specifications the
availableEncodingsarray actually contains.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginGetCountDestinationTextEncodingsPtr
Defines a pointer to a function that counts and returns the number of destination encodings to which a specified source encoding can be converted in one step.
typedef OSStatus (*TECPluginGetCountDestinationTextEncodingsPtr) ( TextEncoding inputEncoding, TextEncoding * destinationEncodings, ItemCount maxDestinationEncodings, ItemCount * actualDestinationEncodings );
If you name your function MyTECPluginGetCountDestinationTextEncodings,
you would declare it like this:
OSStatus MyTECPluginGetCountDestinationTextEncodingsPtr ( TextEncoding inputEncoding, TextEncoding * destinationEncodings, ItemCount maxDestinationEncodings, ItemCount * actualDestinationEncodings );
Parameters
- inputEncoding
The text encoding specification describing the source text.
- destinationEncodings
On return, a pointer to text encodings to which the source encoding can be converted in one step.
- maxDestinationEncodings
The maximum number of text encodings that can be specified by the
destinationEncodingsparameter.- actualDestinationEncodings
On return, the actual number of text encodings specified by the
destinationEncodingsparameter.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginGetCountMailEncodingsPtr
Defines a pointer to a function that obtains the text encodings available for email.
typedef OSStatus (*TECPluginGetCountMailEncodingsPtr) ( TextEncoding * availableEncodings, ItemCount maxAvailableEncodings, ItemCount * actualAvailableEncodings );
If you name your function MyTECPluginGetCountMailEncodings,
you would declare it like this:
OSStatus MyTECPluginGetCountMailEncodingsPtr ( TextEncoding * availableEncodings, ItemCount maxAvailableEncodings, ItemCount * actualAvailableEncodings );
Parameters
- availableEncodings
On return, a pointer to the text encodings available for email.
- maxAvailableEncodings
The maximum number of text encodings that can be specified by the
availableEncodingsparameter.- actualAvailableEncodings
On return, the number of text encoding specifications
availableEncodingsactually contains.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginGetCountSubTextEncodingsPtr
Defines a pointer to a function that obtains the text encoding specifications for the subencodings the encoding scheme supports.
typedef OSStatus (*TECPluginGetCountSubTextEncodingsPtr) ( TextEncoding inputEncoding, TextEncoding subEncodings[], ItemCount maxSubEncodings, ItemCount * actualSubEncodings );
If you name your function MyTECPluginGetCountSubTextEncodings,
you would declare it like this:
OSStatus MyTECPluginGetCountSubTextEncodingsPtr ( TextEncoding inputEncoding, TextEncoding subEncodings[], ItemCount maxSubEncodings, ItemCount * actualSubEncodings );
Parameters
- inputEncoding
A text encoding specification.
- subEncodings
On return, the array contains the specifications for the subencodings of the
inputEncodingparameter.- maxSubEncodings
The number of text encoding specifications the
subEncodingsarray can contain.- actualSubEncodings
On return, a pointer to number of subencodings in the
subEncodingsarray.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginGetCountWebEncodingsPtr
Defines a pointer to a function that obtains the available web text encodings.
typedef OSStatus (*TECPluginGetCountWebEncodingsPtr) ( TextEncoding * availableEncodings, ItemCount maxAvailableEncodings, ItemCount * actualAvailableEncodings );
If you name your function MyTECPluginGetCountWebEncodings,
you would declare it like this:
OSStatus MyTECPluginGetCountWebEncodingsPtr ( TextEncoding * availableEncodings, ItemCount maxAvailableEncodings, ItemCount * actualAvailableEncodings );
Parameters
- availableEncodings
On return, points to the currently supported text encodings available for the web.
- maxAvailableEncodings
The number of text encodings specifications that
availableEncodingscan specify.- actualAvailableEncodings
On return, the number of text encodings specifications
availableEncodingsactually contains.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginGetPluginDispatchTablePtr
Defines a pointer to a function that returns a pointer to a plug-in dispatch table.
typedef TECPluginDispatchTable * (*TECPluginGetPluginDispatchTablePtr) ( );
If you name your function ConverterPluginGetPluginDispatchTable,
you would declare it like this:
TECPluginDispatchTable * ConverterPluginGetPluginDispatchTable();
Parameters
Return Value
A pointer to the function dispatch table for the plug-in.
Discussion
You need this callback only for OS X plug-ins. When you
create a TEC plug-in in OS X you must export a function named ConverterPluginGetPluginDispatchTable with
the following prototype:
extern TECPluginDispatchTable *ConverterPluginGetPluginDispatchTable
(void)
This function must return a pointer to the function dispatch
table for the plug-in. It is important you name the function ConverterPluginGetPluginDispatchTable because TECPluginGetPluginDispatchTablePtr is
a function pointer to a function of this exact name.
Availability
- Available in OS X v10.1 and later.
Declared In
TextEncodingPlugin.hTECPluginGetTextEncodingFromInternetNamePtr
Defines a pointer to a function that obtains the text encoding for an Internet text encoding name.
typedef OSStatus (*TECPluginGetTextEncodingFromInternetNamePtr) ( TextEncoding * textEncoding, ConstStr255Param encodingName );
If you name your function MyTECPluginGetTextEncodingFromInternetName,
you would declare it like this:
OSStatus MyTECPluginGetTextEncodingFromInternetNamePtr ( TextEncoding * textEncoding, ConstStr255Param encodingName );
Parameters
- textEncoding
On return, a pointer to a structure that contains a text encoding specification for the text encoding name specified by the
encodingNameparameter.- encodingName
An Internet encoding name, in 7-bit US ASCII.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginGetTextEncodingInternetNamePtr
Defines a pointer to a function that obtains the Internet text encoding name for a text encoding specification.
typedef OSStatus (*TECPluginGetTextEncodingInternetNamePtr) ( TextEncoding textEncoding, Str255 encodingName );
If you name your function MyTECPluginGetTextEncodingInternetName,
you would declare it like this:
OSStatus MyTECPluginGetTextEncodingInternetNamePtr ( TextEncoding textEncoding, Str255 encodingName );
Parameters
- textEncoding
A text encoding specification.
- encodingName
On return, the Internet encoding name, in 7-bit US ASCII. If there are several Internet encoding names for the same text encoding, the
encodingNameparameter contains the preferred name.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginNewEncodingConverterPtr
Defines a pointer to a function that determines a conversion path for a source and destination encoding, then creates a text encoding converter object and returns a pointer to it.
typedef OSStatus (*TECPluginNewEncodingConverterPtr) ( TECObjectRef * newEncodingConverter, TECConverterContextRec * plugContext, TextEncoding inputEncoding, TextEncoding outputEncoding );
If you name your function MyTECPluginNewEncodingConverter,
you would declare it like this:
OSStatus MyTECPluginNewEncodingConverterPtr ( TECObjectRef * newEncodingConverter, TECConverterContextRec * plugContext, TextEncoding inputEncoding, TextEncoding outputEncoding );
Parameters
- newEncodingConverter
A pointer to a converter object. On return, this points to a newly created text converter object.
- plugContext
A pointer to a TEC converter context record.
- inputEncoding
The text encoding specification for the source text.
- outputEncoding
The text encoding specification for the destination text.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginNewEncodingSnifferPtr
Defines a pointer to a function that creates a sniffer object and returns a reference to it.
typedef OSStatus (*TECPluginNewEncodingSnifferPtr) ( TECSnifferObjectRef * encodingSniffer, TECSnifferContextRec * snifContext, TextEncoding inputEncoding );
If you name your function MyTECPluginNewEncodingSniffer,
you would declare it like this:
OSStatus MyTECPluginNewEncodingSnifferPtr ( TECSnifferObjectRef * encodingSniffer, TECSnifferContextRec * snifContext, TextEncoding inputEncoding );
Parameters
- encodingSniffer
A pointer to a sniffer object reference, which is of type
TECSnifferObjectRef. On return, the reference pertains to the newly created sniffer object.- snifContext
A pointer to a TEC sniffer context record.
- inputEncoding
The text encoding specification to be detected by the sniffer object.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginSniffTextEncodingPtr
Defines a pointer to a function that analyzes a text stream and returns the probable encodings in a ranked list, based on an array of possible encodings you supply; it also returns the number of errors and features for each encoding.
typedef OSStatus (*TECPluginSniffTextEncodingPtr) ( TECSnifferObjectRef encodingSniffer, TECSnifferContextRec * snifContext );
If you name your function MyTECPluginSniffTextEncoding,
you would declare it like this:
OSStatus MyTECPluginSniffTextEncodingPtr ( TECSnifferObjectRef encodingSniffer, TECSnifferContextRec * snifContext );
Parameters
- encodingSniffer
A reference to a sniffer object.
- snifContext
A pointer to a TEC sniffer context record.
Return Value
A result code. See “TEC Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hUnicodeToTextFallbackProcPtr
Defines a pointer to a function that converts a Unicode text element for which there is no destination encoding equivalent in the appropriate mapping table to the fallback character sequence defined by your fallback handler, and returns the converted character sequence to the Unicode Converter.
typedef OSStatus (*UnicodeToTextFallbackProcPtr) ( UniChar * iSrcUniStr, ByteCount iSrcUniStrLen, ByteCount * oSrcConvLen, TextPtr oDestStr, ByteCount iDestStrLen, ByteCount * oDestConvLen, LogicalAddress iInfoPtr, ConstUnicodeMappingPtr iUnicodeMappingPtr );
If you name your function MyUnicodeToTextFallbackProc,
you would declare it like this:
OSStatus MyUnicodeToTextFallbackProcPtr ( UniChar * iSrcUniStr, ByteCount iSrcUniStrLen, ByteCount * oSrcConvLen, TextPtr oDestStr, ByteCount iDestStrLen, ByteCount * oDestConvLen, LogicalAddress iInfoPtr, ConstUnicodeMappingPtr iUnicodeMappingPtr );
Parameters
- iSrcUniStr
A pointer to a single UTF-16 character to be mapped by the fallback handler.
- iSrcUniStrLen
The length in bytes of the UTF-16 character indicated by the
iSrcUniStrparameter. Usually this is 2 bytes, but it could be 4 bytes for a non-BMP character.- oSrcConvLen
On return, a pointer to the length in bytes of the portion of the Unicode character that was actually processed by your fallback handler. Your fallback handler returns this value. It should set this to 0 if none of the text was handled, or 2 or 4 if the Unicode character was handled. This value is initialized to 0 before the fallback handler is called.
- oDestStr
A pointer to the output buffer where your handler should place any converted text.
- iDestStrLen
The maximum size in bytes of the buffer provided by the
oDestStrparameter.- oDestConvLen
On return, a pointer to the length in bytes of the fallback character sequence generated by your fallback handler. Your handler should return this length. It is initialized to 0 (zero) before the fallback handler is called.
- iInfoPtr
A pointer to a block of memory allocated by your application, which can be used by your fallback handler in any way that you like. This is the same pointer passed as the last parameter of
SetFallbackUnicodeToTextorSetFallbackUnicodeToTextRun. How you use the data passed to you in this memory block is particular to your handler. This is similar in use to a reference constant (refcon).- iUnicodeMappingPtr
A constant pointer to a structure of type
UnicodeMapping. This structure identifies a Unicode encoding specification and a particular base encoding specification.
Return Value
A result
code. See “TEC Manager Result Codes.” Your handler should return noErr if
it can handle the fallback, or kTECUnmappableElementErr if
it cannot. It can return other errors for exceptional conditions,
such as when the output buffer is too small. If your handler returns kTECUnmappableElementErr,
then oSrcConvLen and oDestConvLen are
ignored because either the default handler will be called or the
default fallback sequence will be used.
Discussion
The Unicode Converter calls your fallback handler when it
cannot convert a text string using the mapping table specified by
the Unicode converter object passed to either ConvertFromUnicodeToText or ConvertFromUnicodeToPString.
The control flags you set for the controlFlags parameter
of the function SetFallbackUnicodeToText or
the SetFallbackUnicodeToTextRun stipulate
which fallback handler the Unicode Converter should call and which
one to try first if both can be used.
When the Unicode Converter calls your handler, it passes to it the Unicode character to be converted and its length, a buffer for the converted string you return and the buffer length, and a pointer to a block of memory containing the data your application supplied to be passed on to your fallback handler.
After you convert the Unicode text segment to fallback characters, you return the fallback character sequence of the converted text in the buffer provided to you and the length in bytes of this fallback character sequence. You also return the length in bytes of the portion of the source Unicode text element that your handler actually processed.
You provide a fallback-handler function for use with the function CreateUnicodeToTextInfoByEncoding, ConvertFromUnicodeToPString, ConvertFromUnicodeToTextRun,
or ConvertFromUnicodeToScriptCodeRun.
You associate an application-defined fallback handler with a particular
Unicode converter object you intend to pass to the conversion function
when you call it.
Text converted from UTF-8 will already have been converted to UTF-16 before the fallback handler is called to process it. Your fallback handler should do all of its processing on text encoded in UTF-16.
Your application-defined fallback handler should not move
memory or call any toolbox function that would move memory. If it
needs memory, the memory should be allocated before the call to SetFallbackUnicodeToText or SetFallbackUnicodeToTextRun,
and a memory reference should be passed either directly as iInfoPtr or
in the data referenced by iInfoPtr.
To associate a fallback-handler function with a Unicode converter
object you use the SetFallbackUnicodeToText and SetFallbackUnicodeToTextRun functions.
For these functions, you must pass a universal procedure pointer
(UniversalProcPtr). This
is derived from a pointer to your function by using the predefined
macro NewUnicodeToTextFallbackProc.
For versions of the Unicode Converter prior to 1.2, the fallback
handler may receive a multiple character text element, so the source
string length value could be greater than 2 and the fallback handler
may set srcConvLen to
a value greater than 2. In versions earlier than 1.2.1, the srcConvLen and destConvLen variables
are not initialized to 0; both values are ignored unless the fallback
handler returns noErr.
The following example shows how to install an application-defined
fallback handler. You can name your application-defined fallback
handler anything you choose. The name, MyUnicodeToTextFallbackProc,
used in this example is not significant. However, you must adhere
to the parameters, the return type, and the calling convention as
expressed in this example, which follows the prototype, because
a pointer to this function must be of type UnicodeToTextFallbackProcPtr as
defined in the UnicodeConverter.h header
file.
The UnicodeConverter.h header
file also defines the UnicodeToTextFallbackUPP type
and the NewUnicodeToTextFallbackProc macro.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hData Types
ConstScriptCodeRunPtr
Defines a constant script code run pointer.
typedef const ScriptCodeRun * ConstScriptCodeRunPtr;
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hConstTextEncodingRunPtr
Defines a constant text encoding run pointer.
typedef const TextEncodingRun * ConstTextEncodingRunPtr;
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hConstTextPtr
Defines a constant text pointer.
typedef const UInt8 * ConstTextPtr;
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hConstTextToUnicodeInfo
Defines a constant text to Unicode converter object.
typedef TextToUnicodeInfo ConstTextToUnicodeInfo;
Discussion
The TruncateForTextToUnicode function requires a Unicode converter object as a parameter. This function does not modify the contents of the private structure to which the Unicode converter object refers, so it uses the constant Unicode converter object defined by the ConstTextToUnicodeInfo data type.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hConstUniCharArrayPtr
Defines a constant Unicode character array pointer.
typedef const UniChar * ConstUniCharArrayPtr;
Discussion
You specify a constant Unicode character array pointer for Unicode strings used within the scope of a function whose contents are not modified by that function.
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hConstUnicodeMappingPtr
Defines a constant Unicode mapping pointer.
typedef const UnicodeMapping * ConstUnicodeMappingPtr;
Discussion
Many Unicode Converter functions take a pointer to a Unicode mapping structure as a parameter. For functions that do not modify the Unicode mapping contents, the Unicode Converter provides a constant pointer to a Unicode mapping structure defined by the ConstUnicodeMappingPtr data type.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hConstUnicodeToTextInfo
Defines a constant Unicode to text converter object.
typedef UnicodeToTextInfo ConstUnicodeToTextInfo;
Discussion
The TruncateForUnicodeToText function requires a Unicode converter object as a parameter. This function does not modify the contents of the private structure to which the Unicode converter object refers, so it uses the constant Unicode converter object defined by the ConstUnicodeToTextInfo data type.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hScriptCodeRun
Contains script code information for a text run.
struct ScriptCodeRun {
ByteOffset offset;
ScriptCode script;
};
typedef struct ScriptCodeRun ScriptCodeRun;
typedef ScriptCodeRun * ScriptCodeRunPtr;
Fields
offsetThe beginning character position of a text run and its script code in the converted text.
scriptThe script code for the text that begins at the position specified.
Discussion
To return the result of a multiple encoding conversion, the ConvertFromUnicodeToScriptCodeRun function uses a script code run structure.
The script code run structure uses an extended script code with values in the range 0–254, which are the text encoding base equivalents to Mac OS encodings. Values 0–32 correspond directly to traditional script codes. This allows a script code run to distinguish Icelandic, Turkish, Symbol, Zapf Dingbats, and so on.
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hTECBufferContextRec
Contains buffers for text and text encoding runs.
struct TECBufferContextRec {
TextPtr textInputBuffer;
TextPtr textInputBufferEnd;
TextPtr textOutputBuffer;
TextPtr textOutputBufferEnd;
TextEncodingRunPtr encodingInputBuffer;
TextEncodingRunPtr encodingInputBufferEnd;
TextEncodingRunPtr encodingOutputBuffer;
TextEncodingRunPtr encodingOutputBufferEnd;
};
typedef struct TECBufferContextRec TECBufferContextRec;
Discussion
This structure is used in the TECConverterContextRec data structure that is used for a TEC plug-in.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECConversionInfo
Contains text encoding conversion information.
struct TECConversionInfo {
TextEncoding sourceEncoding;
TextEncoding destinationEncoding;
UInt16 reserved1;
UInt16 reserved2;
};
typedef struct TECConversionInfo TECConversionInfo;
Fields
sourceEncodingThe text encoding specification for the source text.
destinationEncodingThe text encoding specification for the destination text.
reserved1Reserved.
reserved2Reserved.
Discussion
When you call the function TECGetDirectTextEncodingConversions, you pass an array of text encoding conversion information structures. The function fills these structures with information about each type of supported conversion.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECConverterContextRec
Contains converter information used by a Text Encoding Converter plug-in.
struct TECConverterContextRec {
Ptr pluginRec;
TextEncoding sourceEncoding;
TextEncoding destEncoding;
UInt32 reserved1;
UInt32 reserved2;
TECBufferContextRec bufferContext;
UInt32 contextRefCon;
ProcPtr conversionProc;
ProcPtr flushProc;
ProcPtr clearContextInfoProc;
UInt32 options1;
UInt32 options2;
TECPluginStateRec pluginState;
};
typedef struct TECConverterContextRec TECConverterContextRec;
Fields
pluginRecsourceEncodingThe text encoding specification for the source text.
destEncodingThe text encoding specification for the destination text.
reserved1Reserved.
reserved2Reserved.
bufferContextcontextRefConA 32-bit value containing or referring to plug-in-specific data.
conversionProcA pointer to a callback for your conversion procedure.
flushProcA pointer to a callback for your reset procedure.
clearContextInfoProcA pointer to a callback for our clear procedure.
options1A 32-bit value that specfies options needed by your plug-in.
options2A 32-bit value that specfies options needed by your plug-in.
pluginState
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECInfo
Contains information about the Unicode Converter, the Text Encoding Converter, and Basic Text Types.
struct TECInfo {
UInt16 format;
UInt16 tecVersion;
UInt32 tecTextConverterFeatures;
UInt32 tecUnicodeConverterFeatures;
UInt32 tecTextCommonFeatures;
Str31 tecTextEncodingsFolderName;
Str31 tecExtensionFileName;
UInt16 tecLowestTEFileVersion;
UInt16 tecHighestTEFileVersion;
};
typedef struct TECInfo TECInfo;
typedef TECInfo * TECInfoPtr;
Fields
formatThe current format of the returned structure. The format of the structure is indicated by the
kTECInfoCurrentFormatconstant. Any future changes to the format will always be backwardly compatible; any new fields will be added to the end of the structure.tecVersionThe current version of the Text Encoding Conversion Manager extension in BCD (binary coded decimal), with the first byte indicating the major version; for example, 0x0121 for 1.2.1.
tecTextConverterFeaturesNew features or bug fixes in the Text Encoding Converter. No bits are currently defined.
tecUnicodeConverterFeaturesBit flags indicating new features or bug fixes in the Unicode Converter. See “Unicode Converter Flags” for the currently defined bit flags.
tecTextCommonFeaturesBit flags indicating new features or bug fixes in Basic Text Types (the Text Common static library). No bits are currently defined.
tecTextEncodingsFolderNameA Pascal string with the (possibly localized) name of the Text Encodings folder.
tecExtensionFileNameA Pascal string with the (possibly localized) name of the Text Encoding Conversion Manager extension file.
tecLowestTEFileVersiontecHighestTEFileVersion
Discussion
The converter information structure is used by the function TECGetInfo to hold returned information about the Unicode Converter, the Text Encoding Converter, and Basic Text Types.
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hTECObjectRef
Defines an opaque reference to a converter object.
typedef struct OpaqueTECObjectRef * TECObjectRef;
Discussion
When making a text conversion, the Text Encoding Converter requires a reference to a converter object that indicates how to accomplish the conversion. Functions, such as TECCreateConverter, that create a converter object return this reference, which you can then pass to other functions when converting text. A converter object reference is defined by the TECObjectRef data type.
The structure of the OpaqueTECObjectRef data type is private, and a converter object is not accessible directly.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECPluginDispatchTable
Contains version and signature information and pointers to the callback functions used by a text encoding converter plug-in.
struct TECPluginDispatchTable {
TECPluginVersion version;
TECPluginVersion compatibleVersion;
TECPluginSignature PluginID;
TECPluginNewEncodingConverterPtr PluginNewEncodingConverter;
TECPluginClearContextInfoPtr PluginClearContextInfo;
TECPluginConvertTextEncodingPtr PluginConvertTextEncoding;
TECPluginFlushConversionPtr PluginFlushConversion;
TECPluginDisposeEncodingConverterPtr PluginDisposeEncodingConverter;
TECPluginNewEncodingSnifferPtr PluginNewEncodingSniffer;
TECPluginClearSnifferContextInfoPtr PluginClearSnifferContextInfo;
TECPluginSniffTextEncodingPtr PluginSniffTextEncoding;
TECPluginDisposeEncodingSnifferPtr PluginDisposeEncodingSniffer;
TECPluginGetCountAvailableTextEncodingsPtr PluginGetCountAvailableTextEncodings;
TECPluginGetCountAvailableTextEncodingPairsPtr PluginGetCountAvailableTextEncodingPairs;
TECPluginGetCountDestinationTextEncodingsPtr PluginGetCountDestinationTextEncodings;
TECPluginGetCountSubTextEncodingsPtr PluginGetCountSubTextEncodings;
TECPluginGetCountAvailableSniffersPtr PluginGetCountAvailableSniffers;
TECPluginGetCountWebEncodingsPtr PluginGetCountWebTextEncodings;
TECPluginGetCountMailEncodingsPtr PluginGetCountMailTextEncodings;
TECPluginGetTextEncodingInternetNamePtr PluginGetTextEncodingInternetName;
TECPluginGetTextEncodingFromInternetNamePtr PluginGetTextEncodingFromInternetName;
};
typedef struct TECPluginDispatchTable TECPluginDispatchTable;
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginSig
Defines a data type for a Text Encoding Converter plug-in signature.
typedef OSType TECPluginSig;
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECPluginSignature
Defines a data type for a Text Encoding Converter plug-in signature.
typedef OSType TECPluginSignature;
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECPluginStateRec
Contains state information for a Text Encoding Converter plug-in.
struct TECPluginStateRec {
UInt8 state1;
UInt8 state2;
UInt8 state3;
UInt8 state4;
UInt32 longState1;
UInt32 longState2;
UInt32 longState3;
UInt32 longState4;
};
typedef struct TECPluginStateRec TECPluginStateRec;
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECPluginVersion
Defines a data type for Text Encoding Converter plug-in version.
typedef UInt32 TECPluginVersion;
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTECSnifferContextRec
Contains infomation used by a sniffer object.
struct TECSnifferContextRec {
Ptr pluginRec;
TextEncoding encoding;
ItemCount maxErrors;
ItemCount maxFeatures;
TextPtr textInputBuffer;
TextPtr textInputBufferEnd;
ItemCount numFeatures;
ItemCount numErrors;
UInt32 contextRefCon;
ProcPtr sniffProc;
ProcPtr clearContextInfoProc;
TECPluginStateRec pluginState;
};
typedef struct TECSnifferContextRec TECSnifferContextRec;
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingPlugin.hTECSnifferObjectRef
Defines a reference to an opaque sniffer object.
typedef struct OpaqueTECSnifferObjectRef * TECSnifferObjectRef;
Discussion
When analyzing text for possible encodings, the Text Encoding Converter requires a reference to a sniffer object that specifies what types of encodings can be detected. You receive this reference when calling the function TECCreateSniffer. A sniffer object reference is defined by the TECSnifferObjectRef data type. The structure of the OpaqueTECObjectRef data type is private, and a sniffer object is not accessible directly.
Availability
- Available in OS X v10.0 and later.
Declared In
TextEncodingConverter.hTextEncoding
Defines a data type for a text encoding value.
typedef UInt32 TextEncoding;
Discussion
A TextEncoding value is specified by a text encoding base, a text encoding variant, and a text encoding format. You can obtain a TextEncoding value by calling the function CreateTextEncoding. When you call this function, you can provide the TextEncodingBase, TextEncodingVariant, and TextEncodingFormat data types.
A TextEncoding value is used, for example, to identify the encoding of text passed to a text converter. Two TextEncoding values are needed—for source and destination encoding—when calling the Text Encoding Converter or the Unicode Converter to convert text.
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hTextEncodingRun
Contains text encoding information for a text run.
struct TextEncodingRun {
ByteOffset offset;
TextEncoding textEncoding;
};
typedef struct TextEncodingRun TextEncodingRun;
typedef TextEncodingRun * TextEncodingRunPtr;
Fields
offsetThe beginning character position of a run of text in the converted text string.
textEncodingThe encoding of the text run that begins at the position specified.
Discussion
It is not always possible to convert text expressed in Unicode to another single encoding because no other single encoding encompasses the Unicode character encoding range. To adjust for this, you can create a Unicode mapping structure array that specifies the target encodings the Unicode text should be converted to when multiple encodings must be used.
If the kUnicodeTextRunMask flag is set, ConvertFromUnicodeToTextRun and ConvertFromUnicodeToScriptCodeRun may convert Unicode text to a string of text containing multiple text encoding runs. Each run contains text expressed in a different encoding from that of the preceding or following text segment. For each text encoding run in the string, a TextEncodingRun structure indicates the beginning offset and the text encoding for that run.
Functions that convert text from Unicode to a text run return the converted text in an array of text encoding run structures. A text encoding run structure is defined by the TextEncodingRun data type.
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hTextEncodingVariant
Defines a data type for a text encoding variant.
typedef UInt32 TextEncodingVariant;
Discussion
The following enumerations define text encoding variant constants: “Encoding Variants for Big-5,” “Encoding Variants for MacArabic,” “Encoding Variants for MacCroatian,” “Encoding Variants for MacCyrillic,” “Encoding Variants for MacFarsi,” “Encoding Variants for MacHebrew,” “Encoding Variants for MacIcelandic,” “Encoding Variants for MacJapanese,” “Encoding Variants for MacRoman Related to Currency,” “Encoding Variants for MacRomanian,” “Encoding Variants for MacRomanLatin1,” “Encoding Variants for MacRoman,” and “Encoding Variants for MacVT100.”
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hTextToUnicodeInfo
Defines reference to an opaque Unicode converter object.
typedef struct OpaqueTextToUnicodeInfo * TextToUnicodeInfo;
Discussion
A Unicode converter object is a private object containing mapping and state information. Many of the Unicode Converter functions that perform conversions require a Unicode converter object containing information used for the conversion process. There are three types of Unicode converter objects, all serving the same purpose but used for different types of conversions. You use the TextToUnicodeInfo type, described here, for converting from non-Unicode text to Unicode text.
Because your application cannot directly create or modify the contents of the private Unicode converter object, the Unicode Converter provides functions to create and dispose of it. To create a Unicode converter object for converting from non-Unicode text to Unicode text, your application must first call either the function CreateTextToUnicodeInfo or the function CreateTextToUnicodeInfoByEncoding to provide the mapping information required for the conversion. You can then pass this object to the function ConvertFromTextToUnicode or ConvertFromPStringToUnicode to identify the information to be used in performing the actual conversion. After you have finished using the object, you should release the memory allocated for it by calling the function DisposeTextToUnicodeInfo. The TextToUnicodeInfo data type defines the Unicode converter object.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hUniCharArrayOffset
Represents the boundary between two characters.
typedef UInt32 UniCharArrayOffset;
Discussion
A UniCharArrayOffset represents the boundary between two characters. For example, the first character in a buffer lies between offsets 0 and 1. So the first character in the buffer can be referred to as either “offset 0, leading” or “offset 1, trailing.” This distinction is useful when you deal with caret positions.
Availability
- Available in OS X v10.0 and later.
Declared In
TextCommon.hUnicodeMapping
Contains information for mapping to or from Unicode encoding.
struct UnicodeMapping {
TextEncoding unicodeEncoding;
TextEncoding otherEncoding;
UnicodeMapVersion mappingVersion;
};
typedef struct UnicodeMapping UnicodeMapping;
typedef UnicodeMapping * UnicodeMappingPtr;
Fields
unicodeEncodingA Unicode text encoding specification of type
TextEncoding.otherEncodingA text encoding specification for the text to be converted to or from Unicode.
mappingVersionThe version of the Unicode mapping table to be used.
Discussion
A Unicode mapping structure contains a complete text encoding specification for a Unicode encoding, a complete non-Unicode text encoding specification giving the encoding for the text to be converted to or from Unicode, and the version of the mapping table to be used for conversion. You use a structure of this type to specify the text encodings to and from which the text string is to be converted. A Unicode mapping structure is defined by the UnicodeMapping data type.
You can specify a variety of normalization options by setting up the Unicode mapping structure as described in the following.
To specify normal canonical decomposition according to Unicode 3.2 rules, with no exclusions ("Canonical decomposition 3.2"), set up the UnicodeMapping structure as follows:
mapping.unicodeEncoding (in) = Unicode 2.x-3.x, kUnicodeNoSubset, kUnicode16BitFormat |
mapping.otherEncoding (out) = Unicode 2.x-3.x, kUnicodeCanonicalDecompVariant, kUnicode16BitFormat |
mapping.mappingVersion = kUnicodeUseLatestMapping |
Examples:
u00E0 -> u0061 + u0300 |
u0061 + u0300 -> u0061 + u0300 |
u03AC -> u03B1 + u0301 (3.2 rules) |
uF900 -> u8C48 |
u00E0 + u0323 -> u0061 + u0323 + u0300 (correct) |
To specify canonical decomposition according to Unicode 3.2 rules, with HFS+ exclusions ("HFS+ decomposition 3.2"), set up the UnicodeMapping structure in one of the following ways. The second method is for compatibility with the old method of using mappingVersion = kUnicodeUseHFSPlusMapping.
// Method 1 |
mapping.unicodeEncoding (in) = Unicode 2.x-3.x, kUnicodeNoSubset, kUnicode16BitFormat |
mapping.otherEncoding (out) = Unicode 2.x-3.x, kUnicodeHFSPlusDecompVariant, kUnicode16BitFormat |
mapping.mappingVersion = kUnicodeUseLatestMapping |
// Method 2 |
mapping.unicodeEncoding (in) = Unicode 2.x-3.x, kUnicode16BitFormat, kUnicode16BitFormat |
mapping.otherEncoding (out) = Unicode 2.x, kUnicodeCanonicalDecompVariant, kUnicode16BitFormat |
mapping.mappingVersion = kUnicodeUseHFSPlusMapping |
Examples:
u00E0 -> u0061 + u0300 |
u0061 + u0300 -> u0061 + u0300 |
u03AC -> u03B1 + u0301 (3.2 rules) |
uF900 -> uF900 (decomposition excluded for HFS+) |
u00E0 + u0323 -> u0061 + u0323 + u0300 (correct) |
To specify normal canonical composition according to Unicode 3.2 rules, set up the UnicodeMapping structure as follows:
mapping.unicodeEncoding (in) = Unicode 2.x-3.x, kUnicodeNoSubset, kUnicode16BitFormat |
mapping.otherEncoding (out) = Unicode 2.x-3.x, kUnicodeCanonicalCompVariant, kUnicode16BitFormat |
mapping.mappingVersion = kUnicodeUseLatestMapping |
Examples:
u00E0 -> u00E0 |
u0061 + u0300 -> u00E0 |
u03AC -> u03AC |
uF900 -> u8C48 |
u00E0 + u0323 -> u1EA1 u0300 (correct) |
To specify canonical composition according to Unicode 3.2 rules, but using the HFS+ decomposition exclusions, set up the UnicodeMapping structure as follows. This is the form to use if you want to obtain a composed form that dervide from the decomposed form used for HFS+ filenames.
mapping.unicodeEncoding (in) = Unicode 2.x-3.x, kUnicodeNoSubset, kUnicode16BitFormat |
mapping.otherEncoding (out) = Unicode 2.x-3.x, kUnicodeHFSPlusCompVariant, kUnicode16BitFormat |
mapping.mappingVersion = kUnicodeUseLatestMapping |
Examples:
u00E0 -> u00E0 |
u0061 + u0300 -> u00E0 |
u03AC -> u03AC |
uF900 -> uF900 |
u00E0 + u0323 -> u1EA1 u0300 (correct) |
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hUnicodeToTextFallbackUPP
Defines a universal procedure pointer to a Unicode-to-text-fallback callback function.
typedef UnicodeToTextFallbackProcPtr UnicodeToTextFallbackUPP;
Discussion
For more information, see the description of the UnicodeToTextFallbackProcPtr callback function.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hUnicodeToTextInfo
Defines a reference to an opaque Unicode to text converter object.
typedef struct OpaqueUnicodeToTextInfo * UnicodeToTextInfo;
Discussion
Many of the Unicode Converter functions that perform conversions require a Unicode converter object containing information used for the conversion process. There are three types of Unicode converter objects used for different types of conversions. You use the UnicodeToTextInfo type, described here, for converting from Unicode to text.
Because your application cannot directly create or modify the contents of the private Unicode converter object, the Unicode Converter provides functions to create and dispose of it. To create a Unicode converter object for converting from Unicode to text, your application must first call either the function CreateUnicodeToTextInfo or CreateUnicodeToTextInfoByEncoding.
You can then pass this object to the function ConvertFromUnicodeToText or ConvertFromUnicodeToPString to identify the information used to perform the actual conversion. After you have finished using the object, you should release the memory allocated for it by calling the function DisposeUnicodeToTextInfo.
A Unicode converter object for this purpose is defined by the UnicodeToTextInfo data type.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hUnicodeToTextRunInfo
Defines a reference to an opaque Unicode to text run information converter object.
typedef struct OpaqueUnicodeToTextRunInfo * UnicodeToTextRunInfo;
Discussion
Many of the Unicode Converter functions that perform conversions require a Unicode converter object containing information used for the conversion process. There are three types of Unicode converter objects used for different types of conversions. You use the UnicodeToTextRunInfo type, described here, for converting from Unicode to multiple encodings.
Because your application cannot directly create or modify the contents of the private Unicode converter object, the Unicode Converter provides functions to create and dispose of it. You can use any of three functions to create a Unicode converter object for converting from Unicode to multiple encodings. You can use CreateUnicodeToTextRunInfo, CreateUnicodeToTextRunInfoByEncoding, or CreateUnicodeToTextRunInfoByScriptCode.
You can then pass this object to the function ConvertFromUnicodeToTextRun or ConvertFromUnicodeToScriptCodeRun to identify the information used to perform the actual conversion. After you have finished using the object, you should release the memory allocated for it by calling the function DisposeUnicodeToTextRunInfo.
A Unicode converter object for this purpose is defined by the UnicodeToTextRunInfo data type.
Availability
- Available in OS X v10.0 and later.
Declared In
UnicodeConverter.hConstants
Feature Selectors
Conversion Flags
Specify how to perform conversion of text from one encoding to another.
enum {
kUnicodeUseFallbacksBit = 0,
kUnicodeKeepInfoBit = 1,
kUnicodeDirectionalityBits = 2,
kUnicodeVerticalFormBit = 4,
kUnicodeLooseMappingsBit = 5,
kUnicodeStringUnterminatedBit = 6,
kUnicodeTextRunBit = 7,
kUnicodeKeepSameEncodingBit = 8,
kUnicodeForceASCIIRangeBit = 9,
kUnicodeNoHalfwidthCharsBit = 10,
kUnicodeTextRunHeuristicsBit = 11,
kUnicodeMapLineFeedToReturnBit = 12
};
Constants
kUnicodeUseFallbacksBitEnables use of fallback mappings.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeKeepInfoBitSets the keep-information control flag.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeDirectionalityBitsSets directionality.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeVerticalFormBitSets the vertical form control flag.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeLooseMappingsBitEnables use of the loose-mapping portion of a character mapping table.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeStringUnterminatedBitSets the string-unterminated control flag.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeTextRunBitSets the text-run control flag.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeKeepSameEncodingBitSets the keep-same-encoding control flag.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeForceASCIIRangeBitSets the force ASCII range control flag.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeNoHalfwidthCharsBitAvailable in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeTextRunHeuristicsBitAvailable in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeMapLineFeedToReturnBitAvailable in OS X v10.2 and later.
Declared in
UnicodeConverter.h.
Conversion Masks
Set or text for conversion flags.
enum {
kUnicodeUseFallbacksMask = 1L << kUnicodeUseFallbacksBit,
kUnicodeKeepInfoMask = 1L << kUnicodeKeepInfoBit,
kUnicodeDirectionalityMask = 3L << kUnicodeDirectionalityBits,
kUnicodeVerticalFormMask = 1L << kUnicodeVerticalFormBit,
kUnicodeLooseMappingsMask = 1L << kUnicodeLooseMappingsBit,
kUnicodeStringUnterminatedMask = 1L << kUnicodeStringUnterminatedBit,
kUnicodeTextRunMask = 1L << kUnicodeTextRunBit,
kUnicodeKeepSameEncodingMask = 1L << kUnicodeKeepSameEncodingBit,
kUnicodeForceASCIIRangeMask = 1L << kUnicodeForceASCIIRangeBit,
kUnicodeNoHalfwidthCharsMask = 1L << kUnicodeNoHalfwidthCharsBit,
kUnicodeTextRunHeuristicsMask = 1L << kUnicodeTextRunHeuristicsBit,
kUnicodeMapLineFeedToReturnMask = 1L << kUnicodeMapLineFeedToReturnBit
};
Constants
kUnicodeUseFallbacksMaskA mask for setting the Unicode-use-fallbacks conversion flag. The Unicode Converter uses fallback mappings when it encounters a source text element for which there is no equivalent destination encoding. Fallback mappings are mappings that do not preserve the meaning or identity of the source character but represent a useful approximation of it. See the function
SetFallbackUnicodeToText.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeKeepInfoMaskA mask for setting the keep-information control flag which governs whether the Unicode Converter keeps the current state stored in the Unicode converter object before converting the text string.
If you clear this flag, the converter will initialize the Unicode converter object before converting the text string and assume that subsequent calls do not need any context, such as direction state for the current call.
If you set the flag, the converter uses the current state. This is useful if your application must convert a stream of text in pieces that are not block delimited. You should set this flag for each call in a series of calls on the same text stream.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeDirectionalityMaskA mask for setting the directionality control flag
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeVerticalFormMaskA mask for setting the vertical form control flag. The vertical form control flag tells the Unicode Converter how to map text elements for which there are both abstract and vertical presentation forms in the destination encoding.
If set, the converter maps these text elements to their vertical forms, if they are available.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeLooseMappingsMaskA mask that determines whether the Unicode Converter should use the loose-mapping portion of a mapping table for character mapping if the strict mapping portion of the table does not include a destination encoding equivalent for the source text element.
If you clear this flag, the converter will use only the strict equivalence portion.
If set this flag and a conversion for the source text element does not exist in the strict equivalence portion of the mapping table, then the converter uses the loose mapping section.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeStringUnterminatedMaskA mask for setting the string-unterminated control flag. Determines how the Unicode Converter handles text-element boundaries and direction resolution at the end of an input buffer.
If you clear this bit, the converter treats the end of the buffer as the end of text.
If you set this bit, the converter assumes that the next call you make using the current context will supply another buffer of text that should be treated as a continuation of the current text. For example, if the last character in the input buffer is
'A',ConvertFromUnicodeToTextstops conversion at the'A'and returnskTECIncompleteElementErr, because the next buffer could begin with a combining diacritical mark that should be treated as part of the same text element. If the last character in the input buffer is a control character,ConvertFromUnicodeToTextdoes not returnkTECIncompleteElementErrbecause a control character could not be part of a multiple character text element.In attempting to analyze the text direction, when the Unicode Converter reaches the end of the current input buffer and the direction of the current text element is still unresolved, if you clear this flag, the converter treats the end of the buffer as a block separator for direction resolution. If you set this flag, it sets the direction as undetermined
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeTextRunMaskA mask for setting the text-run control flag which determines how the Unicode Converter converts Unicode text to a non-Unicode encoding when more than one possible destination encoding exists.
If you clear this flag, the function
ConvertFromUnicodeToTextRunorConvertFromUnicodeToScriptCodeRunattempts to convert the Unicode text to the single encoding from the list of encodings in the Unicode converter object that produces the best result, that is, that provides for the greatest amount of source text conversion.If you set this flag,
ConvertFromUnicodeToTextRunorConvertFromUnicodeToScriptCodeRun, which are the only functions to which it applies, may generate a destination string that combines text in any of the encodings specified by the Unicode converter object.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeKeepSameEncodingMaskA mask for setting the keep-same-encoding control flag. Determines how the Unicode Converter treats the conversion of Unicode text following a text element that could not be converted to the first destination encoding when multiple destination encodings exist. This control flag applies only if the
kUnicodeTextRunMaskcontrol flag is set.If you set this flag, the function
ConvertFromUnicodeToTextRunattempts to minimize encoding changes in the conversion of the source text string; that is, once it is forced to make an encoding change, it attempts to use that encoding as the conversion destination for as long as possible.If you clear this flag,
ConvertFromUnicodeToTextRunattempts to keep most of the converted string in one encoding, switching to other encodings only when necessary.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeForceASCIIRangeMaskA mask for setting the force ASCII range control flag. If an encoding normally treats 1-byte code points
0x00–0x7Fas an ISO 646 national variant that is different from ASCII, setting this flag forces0x00–0x7Fto be treated as ASCII. For example, Japanese encodings such as Shift-JIS generally treat0x00–0x7Fas JIS Roman, with0x5Cas YEN SIGN instead of REVERSE SOLIDUS, but when converting a DOS file path you may want to set this flag so that0x5Cis mapped as REVERSE SOLIDUS.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeNoHalfwidthCharsMaskSets the no halfwidth characters control flag.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeTextRunHeuristicsMaskAvailable in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeMapLineFeedToReturnMaskSpecifies mapping o the LF (LineFeed) character used in Unix to represent new lines to the CR (CarriageReturn) used in Mac encodings. This option has an effect only when used with the constant
kUnicodeLooseMappingsMask. You can pass both constants asiControlFlagsparameters to the functionsConvertFromUnicodeToText,ConvertFromUnicodeToTextRun, andConvertFromUnicodeToScriptCodeRun.Available in OS X v10.2 and later.
Declared in
UnicodeConverter.h.
Discussion
You use these constants to specify how the conversion of text from one encoding to another is performed. You use these masks as the controlFlags parameter in the ConvertFromTextToUnicode, ConvertFromUnicodeToText, ConvertFromUnicodeToScriptCodeRun, ConvertFromUnicodeToTextRun, and TruncateForUnicodeToText functions. A different subset of control masks applies to each of these functions. Using the bitmask constants, you can perform a bitwise OR operation to set the pertinent flags for a particular function’s parameters. For example, when you call a function, you might pass the following controlFlags parameter setting:
controlflags=kUnicodeUseFallbacksMask | kUnicodeLooseMappingsMask;
Directionality Flags
Specify a text direction.
enum {
kUnicodeDefaultDirection = 0,
kUnicodeLeftToRight = 1,
kUnicodeRightToLeft = 2
};
Constants
kUnicodeDefaultDirectionUse the default direction.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeLeftToRightIndicates left to right direction.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeRightToLeftIndicates right to left direction.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.
Directionality Masks
Set or text for directionality bits.
enum {
kUnicodeDefaultDirectionMask = kUnicodeDefaultDirection << kUnicodeDirectionalityBits,
kUnicodeLeftToRightMask = kUnicodeLeftToRight << kUnicodeDirectionalityBits,
kUnicodeRightToLeftMask = kUnicodeRightToLeft << kUnicodeDirectionalityBits
};
Constants
kUnicodeDefaultDirectionMaskA mask for setting the global, or base, line direction for the text being converted. The value
kUnicodeDefaultDirectionMasktells the converter to use the value of the first strong direction character in the string. This determines which direction the converter should use for resolution of neutral coded characters, such as spaces that occur between sets of coded characters having different directions—for example, between Latin and Arabic characters—rendering ambiguous the direction of the space character.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeLeftToRightMaskA mask for setting the global, or base, line direction for the text being converted. The value
kUnicodeLeftToRightMasktells the converter that the base paragraph direction is left to right. This determines which direction the converter should use for resolution of neutral coded characters, such as spaces that occur between sets of coded characters having different directions—for example, between Latin and Arabic characters—rendering ambiguous the direction of the space character.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeRightToLeftMaskThe value
kUnicodeRightToLeftMasktells the converter that the base paragraph direction is right to left. This determines which direction the converter should use for resolution of neutral coded characters, such as spaces that occur between sets of coded characters having different directions—for example, between Latin and Arabic characters—rendering ambiguous the direction of the space character.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.
Unicode Converter Flags
Specify features for bug fixes in the Unicode Converter.
enum {
kTECKeepInfoFixBit = 0,
kTECFallbackTextLengthFixBit = 1,
kTECTextRunBitClearFixBit = 2,
kTECTextToUnicodeScanFixBit = 3,
kTECAddForceASCIIChangesBit = 4,
kTECPreferredEncodingFixBit = 5,
kTECAddTextRunHeuristicsBit = 6,
kTECAddFallbackInterruptBit = 7
};
Constants
kTECKeepInfoFixBitThis is set if the Unicode Converter has a bug fix to stop ignoring certain control flags
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTECFallbackTextLengthFixBitThis is set if the Unicode Converter has a bug fix to use the source length (
srcConvLen)and destination length (destConvLen)returned by a caller-supplied fall-back handler for any status it returns exceptkTECUnmappableElementErr.Previously it honored only these values ifnoErrwas returned.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTECTextRunBitClearFixBitThis is set if
ConvertFromUnicodeToTextRunandConvertFromUnicodeToScriptCodeRunfunction correctly if thekUnicodeTextRunBitis clear.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTECTextToUnicodeScanFixBitThis is set if
ConvertFromTextToUnicodeis enhanced so mappings can depend on context and saved state. The consequences of this are (1) malformed input results inkTextMalformedInputErr; (2)ConvertFromTextToUnicodeaccepts the control flagskUnicodeLooseMappingsMask,kUnicodeKeepInfoMask, andkUnicodeStringUnterminatedMask; (3) elimination of redundant direction overrides when converting Mac OS Arabic and Hebrew to Unicode; and (4) improved mapping of 0x30-0x39 digits in Mac OS Arabic when loose mappings are used.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTECAddForceASCIIChangesBitThis is set if the new control flag bits
kUnicodeForceASCIIRangeBitandkUnicodeNoHalfwidthCharsBitare supported for use with the functionsConvertFromTextToUnicode,ConvertFromUnicodeToText, and so forth.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTECPreferredEncodingFixBitThis is set to indicate that if a preferred encoding is specified for
CreateUnicodeToTextRunInfoand related functions, they handle it correctly even if it does not match the system script.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTECAddTextRunHeuristicsBitAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kTECAddFallbackInterruptBitAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.
Discussion
These are bit flags to indicate new features for bug fixes in the Unicode Converter. They are used by the TECInfo data type.
Unicode Converter Masks
Set or test for Unicode converter flags.
enum {
kTECKeepInfoFixMask = 1L << kTECKeepInfoFixBit,
kTECFallbackTextLengthFixMask = 1L << kTECFallbackTextLengthFixBit,
kTECTextRunBitClearFixMask = 1L << kTECTextRunBitClearFixBit,
kTECTextToUnicodeScanFixMask = 1L << kTECTextToUnicodeScanFixBit,
kTECAddForceASCIIChangesMask = 1L << kTECAddForceASCIIChangesBit,
kTECPreferredEncodingFixMask = 1L << kTECPreferredEncodingFixBit,
kTECAddTextRunHeuristicsMask = 1L << kTECAddTextRunHeuristicsBit,
kTECAddFallbackInterruptMask = 1L << kTECAddFallbackInterruptBit
};
Unicode Fallback Sequencing Flag
Specifies options for setting fallback sequencing.
enum {
kUnicodeFallbackSequencingBits = 0
};
Unicode Fallback Sequencing Masks
Set or text for Unicode sequencing flag.
enum {
kUnicodeFallbackSequencingMask = 3L << kUnicodeFallbackSequencingBits,
kUnicodeFallbackInterruptSafeMask = 1L << 2
};
Constants
kUnicodeFallbackSequencingMaskAvailable in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeFallbackInterruptSafeMaskIndicate that the caller’s fallback routine doesn’t move memory.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.
Unicode Matching Flags
Specify matching criteria for Unicode mappings.
enum {
kUnicodeMatchUnicodeBaseBit = 0,
kUnicodeMatchUnicodeVariantBit = 1,
kUnicodeMatchUnicodeFormatBit = 2,
kUnicodeMatchOtherBaseBit = 3,
kUnicodeMatchOtherVariantBit = 4,
kUnicodeMatchOtherFormatBit = 5
};
Constants
kUnicodeMatchUnicodeBaseBitExcludes mappings that do not match the text encoding base of the
unicodeEncodingfield of the structureUnicodeMapping.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeMatchUnicodeVariantBitExcludes mappings that do not match the text encoding variant of the
unicodeEncodingfield of the specified Unicode mapping structure.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeMatchUnicodeFormatBitExcludes mappings that do not match the text encoding format of the
unicodeEncodingfield of the specified Unicode mapping structure.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeMatchOtherBaseBitExcludes mappings that do not match the text encoding base of the
otherEncodingfield of the structureUnicodeMapping.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeMatchOtherVariantBitExcludes mappings that do not match the text encoding variant of the
otherEncodingfield of the specified Unicode mapping structure.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeMatchOtherFormatBitExcludes mappings that do not match the text encoding format of the
otherEncodingfield of the specified Unicode mapping structure.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.
Unicode Matching Masks
Used to set or test for Unicode matching flags.
enum {
kUnicodeMatchUnicodeBaseMask = 1L << kUnicodeMatchUnicodeBaseBit,
kUnicodeMatchUnicodeVariantMask = 1L << kUnicodeMatchUnicodeVariantBit,
kUnicodeMatchUnicodeFormatMask = 1L << kUnicodeMatchUnicodeFormatBit,
kUnicodeMatchOtherBaseMask = 1L << kUnicodeMatchOtherBaseBit,
kUnicodeMatchOtherVariantMask = 1L << kUnicodeMatchOtherVariantBit,
kUnicodeMatchOtherFormatMask = 1L << kUnicodeMatchOtherFormatBit
};
Constants
kUnicodeMatchUnicodeBaseMaskIf set, excludes mappings that do not match the text encoding base of the
unicodeEncodingfield of the structureUnicodeMapping. If not set, the function ignores the text encoding base of that field.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeMatchUnicodeVariantMaskIf set, excludes mappings that do not match the text encoding variant of the
unicodeEncodingfield of the specified Unicode mapping structure. If not set, the function ignores the text encoding variant of that field.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeMatchUnicodeFormatMaskIf set, excludes mappings that do not match the text encoding format of the
unicodeEncodingfield of the specified Unicode mapping structure. If not set, the function ignores the text encoding format of that field.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeMatchOtherBaseMaskIf set, excludes mappings that do not match the text encoding base of the
otherEncodingfield of the structureUnicodeMapping. If not set, the function ignores the text encoding base of that field.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeMatchOtherVariantMaskIf set, excludes mappings that do not match the text encoding variant of the
otherEncodingfield of the specified Unicode mapping structure. If not set, the function ignores the text encoding variant of that field.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeMatchOtherFormatMaskIf set, excludes mappings that do not match the text encoding format of the
otherEncodingfield of the specified Unicode mapping structure. If not set, the function ignores the text encoding format of that field.Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.
Fallback Handler Selectors
Specify a fallback handler for the Unicode Converter to use.
enum {
kUnicodeFallbackDefaultOnly = 0,
kUnicodeFallbackCustomOnly = 1,
kUnicodeFallbackDefaultFirst = 2,
kUnicodeFallbackCustomFirst = 3
};
Constants
kUnicodeFallbackDefaultOnlyUse the default fallback handler only.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeFallbackCustomOnlyUse the custom fallback handler only.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeFallbackDefaultFirstUse the default fallback handler first, then the custom one.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeFallbackCustomFirstUse the custom fallback handler first, then the default one.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.
Discussion
Used to specify which fallback handler the Unicode Converter should use. If you use both the custom and default handlers, you can set the order in which they are called. You use these constants to set the controlFlags parameter of the SetFallbackUnicodeToText and SetFallbackUnicodeToTextRun functions.
Encodings and Variants
Base Text Encodings
Specify base text encodings.
typedef UInt32 TextEncodingBase;
enum {
kTextEncodingMacRoman = 0,
kTextEncodingMacJapanese = 1,
kTextEncodingMacChineseTrad = 2,
kTextEncodingMacKorean = 3,
kTextEncodingMacArabic = 4,
kTextEncodingMacHebrew = 5,
kTextEncodingMacGreek = 6,
kTextEncodingMacCyrillic = 7,
kTextEncodingMacDevanagari = 9,
kTextEncodingMacGurmukhi = 10,
kTextEncodingMacGujarati = 11,
kTextEncodingMacOriya = 12,
kTextEncodingMacBengali = 13,
kTextEncodingMacTamil = 14,
kTextEncodingMacTelugu = 15,
kTextEncodingMacKannada = 16,
kTextEncodingMacMalayalam = 17,
kTextEncodingMacSinhalese = 18,
kTextEncodingMacBurmese = 19,
kTextEncodingMacKhmer = 20,
kTextEncodingMacThai = 21,
kTextEncodingMacLaotian = 22,
kTextEncodingMacGeorgian = 23,
kTextEncodingMacArmenian = 24,
kTextEncodingMacChineseSimp = 25,
kTextEncodingMacTibetan = 26,
kTextEncodingMacMongolian = 27,
kTextEncodingMacEthiopic = 28,
kTextEncodingMacCentralEurRoman = 29,
kTextEncodingMacVietnamese = 30,
kTextEncodingMacExtArabic = 31,
kTextEncodingMacSymbol = 33,
kTextEncodingMacDingbats = 34,
kTextEncodingMacTurkish = 35,
kTextEncodingMacCroatian = 36,
kTextEncodingMacIcelandic = 37,
kTextEncodingMacRomanian = 38,
kTextEncodingMacCeltic = 39,
kTextEncodingMacGaelic = 40,
kTextEncodingMacKeyboardGlyphs = 41
};
Constants
kTextEncodingMacRomanThe encoding for Mac OS Roman.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacJapaneseThe encoding for Mac OS Japanese.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacChineseTradThe encoding for Mac OS traditional Chinese.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacKoreanThe encoding for Mac OS Korean.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacArabicThe encoding for Mac OS Arabic.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacHebrewThe encoding for Mac OS Hebrew.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacGreekThe encoding for Mac OS Greek.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacCyrillicThe encoding for Mac OS Cyrillic.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacDevanagariThe encoding for Mac OS Devanagari.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacGurmukhiThe encoding for Mac OS Gurmukhi.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacGujaratiThe encoding for Mac OS Gujurati.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacOriyaThe encoding for Mac OS Oriya.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacBengaliThe encoding for Mac OS Bengali.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacTamilThe encoding for Mac OS Tamil.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacTeluguThe encoding for Mac OS Telugu.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacKannadaThe encoding for Mac OS Kannada.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacMalayalamThe encoding for Mac OS Malayalam.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacSinhaleseThe encoding for Mac OS Sinhalese.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacBurmeseThe encoding for Mac OS Burmese.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacKhmerThe encoding for Mac OS Khmer.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacThaiThe encoding for Mac OS Thai.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacLaotianThe encoding for Mac OS Laotian.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacGeorgianThe encoding for Mac OS Georgian.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacArmenianThe encoding for Mac OS Armenian.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacChineseSimpThe encoding for Mac OS simple Chinese.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacTibetanThe encoding for Mac OS Tibetan.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacMongolianThe encoding for Mac OS Mongolian.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacEthiopicThe encoding for Mac OS Ethiopic.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacCentralEurRomanThe encoding for Mac OS Central European Roman.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacVietnameseThe encoding for Mac OS Vietnamese.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacExtArabicThe encoding for Mac OS ExtArabic.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacSymbolThis Mac OS encoding uses script code 0,
smRoman.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacDingbatsThis Mac OS encoding uses script code 0,
smRoman.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacTurkishThis Mac OS encoding uses script code 0,
smRoman.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacCroatianThis Mac OS encoding uses script code 0,
smRoman.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacIcelandicThis Mac OS encoding uses script code 0,
smRoman.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacRomanianThis Mac OS encoding uses script code 0,
smRoman.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacCelticThis Mac OS encoding uses script code 0,
smRoman.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacGaelicThis Mac OS encoding uses script code 0,
smRoman.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacKeyboardGlyphsAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.
Discussion
You use a base text encoding data type to specify which text encoding or text encoding scheme you have used to express a given text. The text encoding base value is the primary specification of the source or target encoding. Values 0 through 32 correspond directly to Mac OS script codes. Values 33 through 254 are for other Mac OS encodings that do not have their own script codes, such as the Symbol encoding implemented by the Symbol font. You can also specify a meta-value as a base text encoding, such as kTextEncodingMacHFS and kTextEncodingUnicodeDefault. A meta-value is mapped to a real value.
The function GetTextEncodingBase returns the text encoding base of a text encoding specification.
A base text encoding is defined by the TextEncodingBase data type.
Compatibility TextEncodings
Specify text encodings that are provided for backward compatibility.
enum {
kTextEncodingMacTradChinese = kTextEncodingMacChineseTrad,
kTextEncodingMacRSymbol = 8,
kTextEncodingMacSimpChinese = kTextEncodingMacChineseSimp,
kTextEncodingMacGeez = kTextEncodingMacEthiopic,
kTextEncodingMacEastEurRoman = kTextEncodingMacCentralEurRoman,
kTextEncodingMacUninterp = 32
};
EBCDIC and IBM Host Text Encodings
Specify text encodings used by IBM computers.
enum {
kTextEncodingEBCDIC_US = 0x0C01,
kTextEncodingEBCDIC_CP037 = 0x0C02
};
Constants
kTextEncodingEBCDIC_USBasic EBCDIC-US encoding.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingEBCDIC_CP037Code page 037, extended EBCDIC-US Latin1.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Discussion
EBCDIC (Extended Binary- Coded Decimal Interchange Code) is used by IBM computers to represent characters as numbers.
Encoding Variants for Big-5
Specify variants of Big-5 encoding.
enum {
kBig5_BasicVariant = 0,
kBig5_StandardVariant = 1,
kBig5_ETenVariant = 2
};
Constants
kBig5_BasicVariantThe basic encoding variant.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kBig5_StandardVariantThe standard variant; 0xC6A1-0xC7FC: kana, Cyrillic, enclosed numerics.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kBig5_ETenVariantAdds kana, Cyrillic, radicals, and so forth with high-bytes C6-C8, F9.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Discussion
Big-5 encoding was developed by five companies as a character set standard in Tawain.
Encoding Variants for Mac OS Encodings
Specify variant Mac OS encodings that use script codes other than 0
enum {
kTextEncodingMacFarsi = 0x8C,
kTextEncodingMacUkrainian = 0x98,
kTextEncodingMacInuit = 0xEC,
kTextEncodingMacVT100 = 0xFC
};
Constants
kTextEncodingMacFarsiUses script code 4,
smArabic. It is similar to Mac Arabic but uses Farsi digits.]Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacUkrainianUses script code 7,
smCyrillic.]Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacInuitUses script code 28,
smEthiopic.]Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacVT100Uses script code 32,
smUninterp; VT100/102 font from the common toolbox; Latin-1 characters plus box drawing.]Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Encoding Variants for MacArabic
Specify variants of MacArabic.
enum {
kMacArabicStandardVariant = 0,
kMacArabicTrueTypeVariant = 1,
kMacArabicThuluthVariant = 2,
kMacArabicAlBayanVariant = 3
};
Constants
kMacArabicStandardVariantA Mac OS Arabic variant is supported by the Cairo font (the system font for Arabic) and is the encoding supported by the text processing utilities.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacArabicTrueTypeVariantA Mac OS Arabic variant used for most of the Arabic TrueType fonts: Baghdad, Geeza, Kufi, Nadeem.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacArabicThuluthVariantA Mac OS Arabic variant used for the Arabic PostScript-only fonts: Thuluth and Thuluth bold.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacArabicAlBayanVariantA Mac OS Arabic variant used for the Arabic TrueType font Al Bayan.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Encoding Variants for MacCroatian
Specify variants of MacCroation.
enum {
kMacCroatianDefaultVariant = 0,
kMacCroatianCurrencySignVariant = 1,
kMacCroatianEuroSignVariant = 2
};
Constants
kMacCroatianDefaultVariantThis is a meta value that maps to one of the following constants, depending on version of the Mac OS.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacCroatianCurrencySignVariantIn versions of Mac OS earlier than 8.5, 0xDB is the currency sign.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacCroatianEuroSignVariantIn Mac OS version 8.5 and later, 0xDB is the Euro sign.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Encoding Variants for MacCyrillic
Specify variants of MacCyrillic.
enum {
kMacCyrillicDefaultVariant = 0,
kMacCyrillicCurrSignStdVariant = 1,
kMacCyrillicCurrSignUkrVariant = 2,
kMacCyrillicEuroSignVariant = 3
};
Constants
kMacCyrillicDefaultVariantThis is a meta value that maps to one of the following constants, depending on version of the Mac OS.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacCyrillicCurrSignStdVariantIn Mac OS versions prior to 9.0 (RU, BG), 0xFF = currency sign, 0xA2/0xB6 = CENT / PARTIAL DIFF.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacCyrillicCurrSignUkrVariantIn Mac OS version 9.0 and later (UA, LangKit), 0xFF = currency sign, 0xA2/0xB6 = GHE with upturn.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacCyrillicEuroSignVariantIn Mac OS 9.0 and later, 0xFF is Euro sign, 0xA2/0xB6 = GHE with upturn.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Encoding Variants for MacFarsi
Specify variants of MacFarsi.
enum {
kMacFarsiStandardVariant = 0,
kMacFarsiTrueTypeVariant = 1
};
Constants
kMacFarsiStandardVariantThis Mac OS Farsi variant is supported by the Tehran font (the system font for Farsi) and is the encoding supported by the text processing utilities.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacFarsiTrueTypeVariantThis Mac OS Farsi variant is used for most of the Farsi TrueType fonts: Ashfahan, Amir, Kamran, Mashad, NadeemFarsi.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Encoding Variants for MacHebrew
Specify variants of MacHebrew.
enum {
kMacHebrewStandardVariant = 0,
kMacHebrewFigureSpaceVariant = 1
};
Constants
kMacHebrewStandardVariantThe standard Mac OS Hebrew variant.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacHebrewFigureSpaceVariantThe Mac OS Hebrew variant in which 0xD4 represents figure space, not left single quotation mark as in the standard variant.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Encoding Variants for MacIcelandic
Specify variants of MacIcelandic.
enum {
kMacIcelandicStdDefaultVariant = 0,
kMacIcelandicTTDefaultVariant = 1,
kMacIcelandicStdCurrSignVariant = 2,
kMacIcelandicTTCurrSignVariant = 3,
kMacIcelandicStdEuroSignVariant = 4,
kMacIcelandicTTEuroSignVariant = 5
};
Constants
kMacIcelandicStdDefaultVariantThis is a meta value that maps to
kMacIcelandicStdCurrSignVariantorkMacIcelandicStdEuroSignVariant, depending on version of the Mac OS.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacIcelandicTTDefaultVariantThis is a meta value that maps to
kMacIcelandicTTCurrSignVariantorkMacIcelandicTTEuroSignVariant, depending on version of the Mac OS.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacIcelandicStdCurrSignVariantIn Mac OS versions prior to 8.5, 0xDB is the currency sign; 0xBB/0xBC are fem./masc. ordinal indicators.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacIcelandicTTCurrSignVariantIn Mac OS versions prior to 8.5, 0xDB is the currency sign; 0xBB/0xBC are fi/fl ligatures
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacIcelandicStdEuroSignVariantIn Mac OS version 8.5 and later , 0xDB is the Euro sign ; 0xBB/0xBC are fem./masc. ordinal indicators.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacIcelandicTTEuroSignVariantIn Mac OS versions earlier than 8.5, 0xDB is the Euro sign; 0xBB/0xBC are fi/fl ligatures.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Encoding Variants for MacJapanese
Specify variants of MacJapanese.
enum {
kMacJapaneseStandardVariant = 0,
kMacJapaneseStdNoVerticalsVariant = 1,
kMacJapaneseBasicVariant = 2,
kMacJapanesePostScriptScrnVariant = 3,
kMacJapanesePostScriptPrintVariant = 4,
kMacJapaneseVertAtKuPlusTenVariant = 5
};
Constants
kMacJapaneseStandardVariantThe standard Mac OS Japanese variant. Shift-JIS with JIS Roman modifications, extra 1-byte characters, 2-byte Apple extensions, and some vertical presentation forms in the range 0xEB40—0xEDFE (“ku plus 84").
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacJapaneseStdNoVerticalsVariantAn artificial Mac OS Japanese variant for callers who don’t want to use separately encoded vertical forms (for example, developers using QuickDraw GX).
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacJapaneseBasicVariantAn artificial Mac OS Japanese variant without Apple double-byte extensions.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacJapanesePostScriptScrnVariantThe Mac OS Japanese variant for the screen bitmap version of the Sai Mincho and Chu Gothic fonts.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacJapanesePostScriptPrintVariantThe Mac OS Japanese variant for PostScript printing versions of the Sai Mincho and Chu Gothic PostScript fonts. This version includes double-byte half-width characters in addition to single-byte half-width characters.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacJapaneseVertAtKuPlusTenVariantThe Mac OS Japanese variant for the Hon Mincho and Maru Gothic fonts used in the Japanese localized version of System 7.1. It does not include the standard Apple extensions, and encodes vertical forms at a different location.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Encoding Variants for MacRoman
Specify variants of MacRoman.
enum {
kMacRomanStandardVariant = 0,
kMacIcelandicStandardVariant = 0,
kMacIcelandicTrueTypeVariant = 1,
kJapaneseStandardVariant = 0,
kJapaneseStdNoVerticalsVariant = 1,
kJapaneseBasicVariant = 2,
kJapanesePostScriptScrnVariant = 3,
kJapanesePostScriptPrintVariant = 4,
kJapaneseVertAtKuPlusTenVariant = 5,
kHebrewStandardVariant = 0,
kHebrewFigureSpaceVariant = 1,
kUnicodeMaxDecomposedVariant = 2,
kUnicodeNoComposedVariant = 3,
kJapaneseNoOneByteKanaOption = 0x20,
kJapaneseUseAsciiBackslashOption = 0x40
};
Constants
kMacRomanStandardVariantThe standard variant of Mac OS Roman for Mac OS 8.5 and later; 0xDB is the Euro sign.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacIcelandicStandardVariantThe standard Mac OS Icelandic encoding supported by the bitmap versions of Chicago, Geneva, Monaco, and New York in the Icelandic system. This is also the variant supported by the text processing utilities.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacIcelandicTrueTypeVariantThe Mac OS Icelandic variant used for the bitmap versions of Courier, Helvetica, Palatino, and Times in the Icelandic system, and for the TrueType versions of Chicago, Geneva, Monaco, New York, Courier, Helvetica, Palatino, and Times.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kJapaneseStandardVariantAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kJapaneseStdNoVerticalsVariantAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kJapaneseBasicVariantAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kJapanesePostScriptScrnVariantAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kJapanesePostScriptPrintVariantAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kJapaneseVertAtKuPlusTenVariantAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kHebrewStandardVariantAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kHebrewFigureSpaceVariantAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kUnicodeMaxDecomposedVariantReplaced by
kUnicodeCanonicalDecompVariant.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUnicodeNoComposedVariantReplaced by
kUnicodeCanonicalCompVariant.Available in OS X v10.0 and later.
Declared in
TextCommon.h.kJapaneseNoOneByteKanaOptionReplaced by Unicode Converter option
kUnicodeNoHalfwidthCharsBit.Available in OS X v10.0 through OS X v10.4.
Declared in
TextCommon.h.kJapaneseUseAsciiBackslashOptionReplaced by Unicode Converter option
kUnicodeForceASCIIRangeBit.Available in OS X v10.0 through OS X v10.4.
Declared in
TextCommon.h.
Encoding Variants for MacRoman Related to Currency
Specify variants of MacRoman that are related to currency.
enum {
kMacRomanDefaultVariant = 0,
kMacRomanCurrencySignVariant = 1,
kMacRomanEuroSignVariant = 2
};
Constants
kMacRomanDefaultVariantThis is a meta value that maps to one of the following constants, depending on version of the Mac OS.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacRomanCurrencySignVariantIn Mac OS versions earlier than 8.5 0xDB is the currency sign; still used for some older fonts even in Mac OS 8.5.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacRomanEuroSignVariantIn Mac OS version 8.5 and later, 0xDB is the Euro sign.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Encoding Variants for MacRomanian
Specify variants of MacRomanian.
enum {
kMacRomanianDefaultVariant = 0,
kMacRomanianCurrencySignVariant = 1,
kMacRomanianEuroSignVariant = 2
};
Constants
kMacRomanianDefaultVariantThis is a meta value that maps to one of the following constants, depending on version of the Mac OS.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacRomanianCurrencySignVariantIn Mac OS versions earlier than 8.5, 0xDB is the currency sign.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacRomanianEuroSignVariantIn Mac OS version 8.5 and later, 0xDB is the Euro sign.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Encoding Variants for MacRomanLatin1
Specify variants of MacRomanLatin1.
enum {
kMacRomanLatin1DefaultVariant = 0,
kMacRomanLatin1StandardVariant = 2,
kMacRomanLatin1TurkishVariant = 6,
kMacRomanLatin1CroatianVariant = 8,
kMacRomanLatin1IcelandicVariant = 11,
kMacRomanLatin1RomanianVariant = 14
};
Constants
kMacRomanLatin1DefaultVariantThis is a meta value that maps to one of the following constants, depending on version of the Mac OS.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacRomanLatin1StandardVariantPermuted MacRoman, Euro sign variant.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacRomanLatin1TurkishVariantPermuted MacTurkish.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacRomanLatin1CroatianVariantPermuted MacCroatian, Euro sign variant.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacRomanLatin1IcelandicVariantPermuted MacIcelandic, standard Euro sign variant.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacRomanLatin1RomanianVariantPermuted MacRomanian, Euro sign variant.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Encoding Variants for MacVT100
Specify variants of MacVT100.
enum {
kMacVT100DefaultVariant = 0,
kMacVT100CurrencySignVariant = 1,
kMacVT100EuroSignVariant = 2
};
Constants
kMacVT100DefaultVariantThis is a meta value that maps to one of the following constants, depending on version of the Mac OS.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacVT100CurrencySignVariantIn Mac OS versions earlier than 8.5, 0xDB is the currency sign.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kMacVT100EuroSignVariantIn Mac OS version 8.5 and later, 0xDB is the Euro sign.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Encoding Variants for Unicode
Specify variants of Unicode.
enum {
kUnicodeNoSubset = 0,
kUnicodeCanonicalDecompVariant = 2,
kUnicodeCanonicalCompVariant = 3,
kUnicodeHFSPlusDecompVariant = 8,
kUnicodeHFSPlusCompVariant = 9
};
Constants
kUnicodeNoSubsetThe standard Unicode encoded character set in which the full set of Unicode characters are supported.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUnicodeCanonicalDecompVariantA variant of Unicode using maximal decomposition with characters in canonical order. This variant does not include most characters which have a canonical decomposition, such as single characters for accented Latin letters or single characters for Korean Hangul syllables (however, this restriction is relaxed for symbol characters in the range U+2000 to U+2FFF). In TEC Manager 1.3, the Unicode Converter supports this variant for converting to and from Mac OS encodings.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUnicodeCanonicalCompVariantThis is the normal canonical composition according to Unicode 3.2 rules.
Available in OS X v10.2 and later.
Declared in
TextCommon.h.kUnicodeHFSPlusDecompVariantSpecifies canonical decomposition according to Unicode 3.2 rules, with HFS+ exclusions ("HFS+ decomposition 3.2"). That is, it doesn't decompose in 2000-2FFF, F900-FAFF, 2F800-2FAFF. You can use ths option when converting HFS file names.
Available in OS X v10.2 and later.
Declared in
TextCommon.h.kUnicodeHFSPlusCompVariantSpecifies canonical composition according to Unicode 3.2 rules, but using the HFS+ decomposition exclusions. You can use ths option when converting HFS file names. You should use this form when you want to obtain a composed form that can be converted to and from the decomposed form specified by
kUnicodeHFSPlusDecompVariant. This is the recommended way to request decompositions with HFS+ exclusions, instead of usingmappingVersion = kUnicodeUseHFSPlusMapping.Available in OS X v10.2 and later.
Declared in
TextCommon.h.
EUC Text Encodings
Specify Extendec Unix Code text encodings.
enum {
kTextEncodingEUC_JP = 0x0920,
kTextEncodingEUC_CN = 0x0930,
kTextEncodingEUC_TW = 0x0931,
kTextEncodingEUC_KR = 0x0940
};
Constants
kTextEncodingEUC_JPISO 646,1-byte katakana,JIS 208 ,JIS 212.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingEUC_CNISO 646, GB 2312-80.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingEUC_TWISO 646, CNS 11643-1992 Planes 1-16.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingEUC_KRISO 646, KS C 5601-1987.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
HFS Text Encoding
Specifies a Mac OS HFS text encoding.
enum {
kTextEncodingMacHFS = 0xFF
};
Constants
kTextEncodingMacHFSThis is a metavalue for a special Mac OS encoding.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
ISO 2022 Text Encodings
Specify text encodings for ISO 2002.
enum {
kTextEncodingISO_2022_JP = 0x0820,
kTextEncodingISO_2022_JP_2 = 0x0821,
kTextEncodingISO_2022_JP_1 = 0x0822,
kTextEncodingISO_2022_JP_3 = 0x0823,
kTextEncodingISO_2022_CN = 0x0830,
kTextEncodingISO_2022_CN_EXT = 0x0831,
kTextEncodingISO_2022_KR = 0x0840
};
Constants
kTextEncodingISO_2022_JPSee RFC 1468.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISO_2022_JP_2See RFC 1554.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISO_2022_JP_1See RFC 2237.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISO_2022_JP_3JIS X0213
Available in OS X v10.1 and later.
Declared in
TextCommon.h.kTextEncodingISO_2022_CNAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISO_2022_CN_EXTAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISO_2022_KRAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.
ISO 8-bit and 7-bit Text Encodings
Specify text encodings for ISO 8-bit and 7-bit.
enum {
kTextEncodingISOLatin1 = 0x0201,
kTextEncodingISOLatin2 = 0x0202,
kTextEncodingISOLatin3 = 0x0203,
kTextEncodingISOLatin4 = 0x0204,
kTextEncodingISOLatinCyrillic = 0x0205,
kTextEncodingISOLatinArabic = 0x0206,
kTextEncodingISOLatinGreek = 0x0207,
kTextEncodingISOLatinHebrew = 0x0208,
kTextEncodingISOLatin5 = 0x0209,
kTextEncodingISOLatin6 = 0x020A,
kTextEncodingISOLatin7 = 0x020D,
kTextEncodingISOLatin8 = 0x020E,
kTextEncodingISOLatin9 = 0x020F
};
Constants
kTextEncodingISOLatin1ISO 8859-1.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISOLatin2ISO 8859-2.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISOLatin3ISO 8859-3.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISOLatin4ISO 8859-4.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISOLatinCyrillicISO 8859-5.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISOLatinArabicISO 8859-6; equivalent to ASMO 708 and DOS CP 708.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISOLatinGreekISO 8859-7.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISOLatinHebrewISO 8859-8.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISOLatin5ISO 8859-9.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISOLatin6ISO 8859-10.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISOLatin7ISO 8859-13; Baltic Rim
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISOLatin8ISO 8859-14; Celtic
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISOLatin9ISO 8859-15, 8859-1; changed for Euro & CP1252 letters
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Mac Unicode Text Encoding
Specifies a script code that should be handled as a special Mac OS script code.
enum {
kTextEncodingMacUnicode = 0x7E
};
Constants
kTextEncodingMacUnicodeBeginning with Mac OS 8.5, the set of Mac OS script codes has been extended for some Mac OS components to include Unicode. Some of these components have only 7 bits available for script code, so
kTextEncodingUnicodeDefaultcannot be used to indicate Unicode. Instead,kTextEncodingMacUnicodeis used as a meta-value to indicate that Unicode handles the script code a special Mac OS script code. The Text Encoding Converter handles this value similar to the way it handles the constantkTextEncodingUnicodeDefault.Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Miscellaneous Text Encoding Standards
Specify miscellaneous text encodings.
enum {
kTextEncodingShiftJIS = 0x0A01,
kTextEncodingKOI8_R = 0x0A02,
kTextEncodingBig5 = 0x0A03,
kTextEncodingMacRomanLatin1 = 0x0A04,
kTextEncodingHZ_GB_2312 = 0x0A05,
kTextEncodingBig5_HKSCS_1999 = 0x0A06
};
Constants
kTextEncodingShiftJISPlain Shift-JIS.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingKOI8_RRussian Internet standard.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingBig5Big-5 encoding.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingMacRomanLatin1Mac OS Roman permuted to align with 8859-1.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingHZ_GB_2312See RFC 1842; for Chinese mail and news.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingBig5_HKSCS_1999Available in OS X v10.1 and later.
Declared in
TextCommon.h.
MS-DOS and Windows Text Encodings
Specify text encodings for MS-DOS and Windows.
enum {
kTextEncodingDOSLatinUS = 0x0400,
kTextEncodingDOSGreek = 0x0405,
kTextEncodingDOSBalticRim = 0x0406,
kTextEncodingDOSLatin1 = 0x0410,
kTextEncodingDOSGreek1 = 0x0411,
kTextEncodingDOSLatin2 = 0x0412,
kTextEncodingDOSCyrillic = 0x0413,
kTextEncodingDOSTurkish = 0x0414,
kTextEncodingDOSPortuguese = 0x0415,
kTextEncodingDOSIcelandic = 0x0416,
kTextEncodingDOSHebrew = 0x0417,
kTextEncodingDOSCanadianFrench = 0x0418,
kTextEncodingDOSArabic = 0x0419,
kTextEncodingDOSNordic = 0x041A,
kTextEncodingDOSRussian = 0x041B,
kTextEncodingDOSGreek2 = 0x041C,
kTextEncodingDOSThai = 0x041D,
kTextEncodingDOSJapanese = 0x0420,
kTextEncodingDOSChineseSimplif = 0x0421,
kTextEncodingDOSKorean = 0x0422,
kTextEncodingDOSChineseTrad = 0x0423,
kTextEncodingWindowsLatin1 = 0x0500,
kTextEncodingWindowsANSI = 0x0500,
kTextEncodingWindowsLatin2 = 0x0501,
kTextEncodingWindowsCyrillic = 0x0502,
kTextEncodingWindowsGreek = 0x0503,
kTextEncodingWindowsLatin5 = 0x0504,
kTextEncodingWindowsHebrew = 0x0505,
kTextEncodingWindowsArabic = 0x0506,
kTextEncodingWindowsBalticRim = 0x0507,
kTextEncodingWindowsVietnamese = 0x0508,
kTextEncodingWindowsKoreanJohab = 0x0510
};
Constants
kTextEncodingDOSLatinUSCode page 437.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSGreekCode page 737, formerly 437G.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSBalticRimCode page 775.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSLatin1Code page 860. “multilingual.”
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSGreek1Code page 851.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSLatin2Code page 852, Slavic.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSCyrillicCode page 855, IBM Cyrillic.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSTurkishCode page 857, IBM Turkish.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSPortugueseCode page 860.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSIcelandicCode page 861.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSHebrewCode page 862.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSCanadianFrenchCode page 863.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSArabicCode page 864.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSNordicCde page 865.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSRussianCode page 866.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSGreek2Code page 869, IBM Modern Green.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSThaiCode page 874, also for Windows.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSJapaneseCode page 932, also for Windows
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSChineseSimplifCode page 936, also for Windows.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSKoreanCode page 949, also for Windows; unified Hangul.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingDOSChineseTradCode page 950, also for Windows.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingWindowsLatin1Code page 1252.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingWindowsANSICode page 1252 (alternate name).
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingWindowsLatin2Code page 1250, Central Europe.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingWindowsCyrillicCode page 1251, Slavic Cyrillic.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingWindowsGreekCode page 1253.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingWindowsLatin5Code page 1254, Turkish.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingWindowsHebrewCode page 1255.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingWindowsArabicCode page 1256.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingWindowsBalticRimCode page 1257.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingWindowsVietnameseCode page 1258.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingWindowsKoreanJohabCode page 1361, for Window NT.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
National Standard Text Encodings
Specify text encodings for various national standards.
enum {
kTextEncodingUS_ASCII = 0x0600,
kTextEncodingJIS_X0201_76 = 0x0620,
kTextEncodingJIS_X0208_83 = 0x0621,
kTextEncodingJIS_X0208_90 = 0x0622,
kTextEncodingJIS_X0212_90 = 0x0623,
kTextEncodingJIS_C6226_78 = 0x0624,
kTextEncodingShiftJIS_X0213_00 = 0x0628,
kTextEncodingGB_2312_80 = 0x0630,
kTextEncodingGBK_95 = 0x0631,
kTextEncodingGB_18030_2000 = 0x0632,
kTextEncodingKSC_5601_87 = 0x0640,
kTextEncodingKSC_5601_92_Johab = 0x0641,
kTextEncodingCNS_11643_92_P1 = 0x0651,
kTextEncodingCNS_11643_92_P2 = 0x0652,
kTextEncodingCNS_11643_92_P3 = 0x0653
};
Constants
kTextEncodingUS_ASCIIAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingJIS_X0201_76JIS Roman and 1-byte katakana (halfwidth).
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingJIS_X0208_83-
Available in OS X v10.0 and later.
Declared in
TextCommon.h. kTextEncodingJIS_X0208_90-
Available in OS X v10.0 and later.
Declared in
TextCommon.h. kTextEncodingJIS_X0212_90-
Available in OS X v10.0 and later.
Declared in
TextCommon.h. kTextEncodingJIS_C6226_78-
Available in OS X v10.0 and later.
Declared in
TextCommon.h. kTextEncodingShiftJIS_X0213_00Shift-JIS format encoding of JIS X0213 planes 1 and 2
Available in OS X v10.1 and later.
Declared in
TextCommon.h.kTextEncodingGB_2312_80Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingGBK_95Annex to GB13000-93, for Windows 95; EUC-CN extended.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingGB_18030_2000Available in OS X v10.1 and later.
Declared in
TextCommon.h.kTextEncodingKSC_5601_87This is the same as KSC 5601-92 without Johab annex.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingKSC_5601_92_JohabKSC 5601-92 Johab annex.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingCNS_11643_92_P1CNS 11643-1992 plane 1.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingCNS_11643_92_P2CNS 11643-1992 plane 2.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingCNS_11643_92_P3CNS 11643-1992 plane 3 (11643-1986 plane 14).
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
NextStep Platform Encodings
Specify text encodings for the NextStep platform.
enum {
kTextEncodingNextStepLatin = 0x0B01,
kTextEncodingNextStepJapanese = 0x0B02
};
Special Text Encoding Values
Specify special cases of text encodings.
enum {
kTextEncodingMultiRun = 0x0FFF,
kTextEncodingUnknown = 0xFFFF
};
Constants
kTextEncodingMultiRunThis is a special value for multiple encoded text, external run information.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingUnknownAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.
Text Encoding Formats
Specify a text encoding format.
typedef UInt32 TextEncodingFormat;
enum {
kTextEncodingDefaultFormat = 0,
kUnicode16BitFormat = 0,
kUnicodeUTF7Format = 1,
kUnicodeUTF8Format = 2,
kUnicode32BitFormat = 3
};
Constants
kTextEncodingDefaultFormatThe standard default format for any base encoding.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUnicode16BitFormatThe 16-bit character encoding format specified by the Unicode standard, equivalent to the UCS-2 format for ISO 10646. This includes support for the UTF-16 method of including non-BMP characters in a stream of 16-bit values.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUnicodeUTF7FormatThe Unicode transformation format in which characters encodings are represented by a sequence of 7-bit values. This format cannot be handled by the Unicode Converter, only by the Text Encoding Converter.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUnicodeUTF8FormatThe Unicode transformation format in which characters are represented by a sequence of 8-bit values.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUnicode32BitFormatThe UCS-4 32-bit format defined for ISO 10646. This format is not currently supported.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Discussion
A text encoding format specifies a way of formatting or algorithmically transforming a particular base encoding. For example, the UTF-7 format is the Unicode standard formatted for transmission through channels that can handle only 7-bit values. Other text encoding formats for Unicode include UTF-8 and 16-bit or 32-bit formats. These transformations are not viewed as different base encodings. Rather, they are different formats for representing the same base encoding.
Similar to text encoding variant values, text encoding format values are specific to a particular text encoding base value or to a small set of text encoding base values. A text encoding format is defined by the TextEncodingFormat data type.
The function GetTextEncodingFormat returns the text encoding format of a text encoding specification.
Text Encoding Name Selectors
Specify the part of an encoding name you want to obtain.
typedef UInt32 TextEncodingNameSelector;
enum {
kTextEncodingFullName = 0,
kTextEncodingBaseName = 1,
kTextEncodingVariantName = 2,
kTextEncodingFormatName = 3
};
Constants
kTextEncodingFullNameRequests the full name of the text encoding.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingBaseNameRequests the name of the base encoding.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingVariantNameRequests the name of the encoding variant, if available.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingFormatNameRequests the name of the encoding format, if available.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Discussion
You use a selector for the GetTextEncodingName function to indicate which part of an encoding name you want to determine. The text encoding name selector is defined by the TextEncodingNameSelector data type.
Text Encoding Variants
Specify minor variants of a base encoding or group of base encodings.
enum {
kTextEncodingDefaultVariant = 0
};
Constants
kTextEncodingDefaultVariantThe standard default variant for any base encoding.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Discussion
This enumeration defines constants for the default variant of any base text encoding and for variants of the Mac OS Japanese, Mac OS Arabic, Mac OS Farsi, Mac OS Hebrew, and Unicode base encodings.
A text encoding variant specifies one among possibly several minor variants of a particular base encoding or group of base encodings. Text encoding variants are often used to support special cases such as the following:
Differences among fonts that are all intended to support the same encoding. For example, different fonts associated with the MacJapanese and MacArabic encodings support slightly different encoding variants. These fonts would typically coexist on the same system without the user being aware of any differences.
Artificial variants created by excluding some of the characters in an encoding. For example, the MacJapanese encoding includes separately-encoded vertical forms for some characters. In some contexts (such as with QuickDraw GX), it may be desirable to exclude these.
Different mappings of a particular character or group of characters for different usages.
For a given text encoding base or small set of related text encoding base values, there may be an enumeration of TextEncodingVariant values, which always begins with 0, the default variant. In addition, for a possibly larger set of related text encoding base values, there may be bit masks that can be used independently to designate additional artificial variants. For example, there is an enumeration of six variants for the Mac OS Japanese encoding. In addition, there are bit masks that can also be used as part of the variant for any Japanese encoding to exclude 1-byte kana or to control the mapping of the reverse solidus (backslash) character.
Languages that are dissimilar but use similar character sets are generally not designated as variants of the same base encoding (for example, MacIcelandic and MacTurkish both use a slight modification of the MacRoman character set, but they are considered separate base encodings).
When you create a new text encoding, you can specify an explicit variant of a base encoding or you can specify the default variant of that base. A text encoding variant is defined by the TextEncodingVariant data type. The function GetTextEncodingVariant returns the text encoding variant of a text encoding specification.
Unicode and ISO UCS Text Encodings
Specify Unicode and IOS UCS text encodings.
enum {
kTextEncodingUnicodeDefault = 0x0100,
kTextEncodingUnicodeV1_1 = 0x0101,
kTextEncodingISO10646_1993 = 0x0101,
kTextEncodingUnicodeV2_0 = 0x0103,
kTextEncodingUnicodeV2_1 = 0x0103,
kTextEncodingUnicodeV3_0 = 0x0104,
kTextEncodingUnicodeV3_1 = 0x0105,
kTextEncodingUnicodeV3_2 = 0x0106
};
Constants
kTextEncodingUnicodeDefaultThis is a meta value that takes on one of the following values, depending on the system.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingUnicodeV1_1This is a Unicode encoding.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingISO10646_1993This ISO UCS encoding has code points identical to Unicode 1.1.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingUnicodeV2_0This is the new location for Korean Hangul.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingUnicodeV2_1For the Text Encoding Converter, Unicode 2.0 is equivalent to Unicode 2.1.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingUnicodeV3_0Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextEncodingUnicodeV3_1Adds characters requiring surrogate pairs in UTF-16
Available in OS X v10.1 and later.
Declared in
TextCommon.h.kTextEncodingUnicodeV3_2Available in OS X v10.1 and later.
Declared in
TextCommon.h.
Unsupported Unicode Variants
Represent Unicode variants that are not yet supported or fully defined.
enum {
kUnicodeNoCompatibilityVariant = 1,
kUnicodeNoCorporateVariant = 4
};
Assorted Constants
Bidirectional Character Values
Specify bidirectional character properties.
enum {
kUCBidiCatNotApplicable = 0,
kUCBidiCatLeftRight = 1,
kUCBidiCatRightLeft = 2,
kUCBidiCatEuroNumber = 3,
kUCBidiCatEuroNumberSeparator = 4,
kUCBidiCatEuroNumberTerminator = 5,
kUCBidiCatArabicNumber = 6,
kUCBidiCatCommonNumberSeparator = 7,
kUCBidiCatBlockSeparator = 8,
kUCBidiCatSegmentSeparator = 9,
kUCBidiCatWhitespace = 10,
kUCBidiCatOtherNeutral = 11,
kUCBidiCatRightLeftArabic = 12,
kUCBidiCatLeftRightEmbedding = 13,
kUCBidiCatRightLeftEmbedding = 14,
kUCBidiCatLeftRightOverride = 15,
kUCBidiCatRightLeftOverride = 16,
kUCBidiCatPopDirectionalFormat = 17,
kUCBidiCatNonSpacingMark = 18,
kUCBidiCatBoundaryNeutral = 19
};
Constants
kUCBidiCatNotApplicableUnassigned.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatLeftRightStrong types: L left-to-right.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatRightLeftStrong types: R right-to-left.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatEuroNumberWeak types: EN European number.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatEuroNumberSeparatorWeak types: ES European number separator.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatEuroNumberTerminatorWeak types: ET European number terminator.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatArabicNumberWeak types: AN Arabic number.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatCommonNumberSeparatorWeak types: CS common number separator.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatBlockSeparatorSeparators: B paragraph separator (was block separator).
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatSegmentSeparatorSeparators: S segment separator.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatWhitespaceNeutrals: WS whitespace.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatOtherNeutralNeutrals: ON other neutrals (unassigned codes could use this).
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatRightLeftArabicUnicode 3.0; AL right-to-left Arabic (was Arabic letter).
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatLeftRightEmbeddingUnicode 3.0; LRE eft-to-right embedding.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatRightLeftEmbeddingUnicode 3.0; RLE right-to-left embedding.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatLeftRightOverrideUnicode 3.0; LRO left-to-right override.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatRightLeftOverrideUnicode 3.0; RLO right-to-left override.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatPopDirectionalFormatUnicode 3.0; PDF pop directional Format.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatNonSpacingMarkUnicode 3.0; NSM non-spacing mark.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCBidiCatBoundaryNeutralUnicode 3.0; BN boundary neutral.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Discussion
These values are requested by kUCCharPropTypeBidiCategory.
Common and Special Unicode Values
Specify sommon and special Unicode code values.
enum {
kUnicodeByteOrderMark = 0xFEFF,
kUnicodeObjectReplacement = 0xFFFC,
kUnicodeReplacementChar = 0xFFFD,
kUnicodeSwappedByteOrderMark = 0xFFFE,
kUnicodeNotAChar = 0xFFFF
};
Constants
kUnicodeByteOrderMarkAvailable in OS X v10.0 and later.
Declared in
TextCommon.h.kUnicodeObjectReplacementA placeholder for a non-text object.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUnicodeReplacementCharUnicode replacement for an input character that cannot be converted.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUnicodeSwappedByteOrderMarkNot a Unicode character; byte-swapped version of FEFF.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUnicodeNotACharNot a Unicode character; may be used as a terminator.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
TEC Plugin Dispatch Table Versions
Specify a version for a TEC plug-in dispatch table.
enum {
kTECPluginDispatchTableVersion1 = 0x00010000,
kTECPluginDispatchTableVersion1_1 = 0x00010001,
kTECPluginDispatchTableVersion1_2 = 0x00010002,
kTECPluginDispatchTableCurrentVersion = kTECPluginDispatchTableVersion1_2
};
Constants
kTECPluginDispatchTableVersion1Specifies versions 1.0 through 1.0.3.
Available in OS X v10.0 and later.
Declared in
TextEncodingPlugin.h.kTECPluginDispatchTableVersion1_1Specifies version 1.1.
Available in OS X v10.0 and later.
Declared in
TextEncodingPlugin.h.kTECPluginDispatchTableVersion1_2Specifies version 1.2.
Available in OS X v10.0 and later.
Declared in
TextEncodingPlugin.h.kTECPluginDispatchTableCurrentVersionA meta value that specifies the current version.
Available in OS X v10.0 and later.
Declared in
TextEncodingPlugin.h.
TEC Plug-in Signatures
Specify a TEC plug-in signature.
enum {
kTECSignature = 'encv',
kTECUnicodePluginSignature = 'puni',
kTECJapanesePluginSignature = 'pjpn',
kTECChinesePluginSignature = 'pzho',
kTECKoreanPluginSignature = 'pkor'
};
Unicode Character Property Types
Specify property types for a Unicode charater.
typedef SInt32 UCCharPropertyType;
enum {
kUCCharPropTypeGenlCategory = 1,
kUCCharPropTypeCombiningClass = 2,
kUCCharPropTypeBidiCategory = 3
};
Constants
kUCCharPropTypeGenlCategoryRequests enumeration value.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCCharPropTypeCombiningClassRequests numeric value 0 to 255.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCCharPropTypeBidiCategoryRequests enumeration value.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Unicode Character Property Values
Specify a propery value for a Unicode character.
typedef UInt32 UCCharPropertyValue;
enum {
kUCGenlCatOtherNotAssigned = 0,
kUCGenlCatOtherControl = 1,
kUCGenlCatOtherFormat = 2,
kUCGenlCatOtherSurrogate = 3,
kUCGenlCatOtherPrivateUse = 4,
kUCGenlCatMarkNonSpacing = 5,
kUCGenlCatMarkSpacingCombining = 6,
kUCGenlCatMarkEnclosing = 7,
kUCGenlCatNumberDecimalDigit = 8,
kUCGenlCatNumberLetter = 9,
kUCGenlCatNumberOther = 10,
kUCGenlCatSeparatorSpace = 11,
kUCGenlCatSeparatorLine = 12,
kUCGenlCatSeparatorParagraph = 13,
kUCGenlCatLetterUppercase = 14,
kUCGenlCatLetterLowercase = 15,
kUCGenlCatLetterTitlecase = 16,
kUCGenlCatLetterModifier = 17,
kUCGenlCatLetterOther = 18,
kUCGenlCatPunctConnector = 20,
kUCGenlCatPunctDash = 21,
kUCGenlCatPunctOpen = 22,
kUCGenlCatPunctClose = 23,
kUCGenlCatPunctInitialQuote = 24,
kUCGenlCatPunctFinalQuote = 25,
kUCGenlCatPunctOther = 26,
kUCGenlCatSymbolMath = 28,
kUCGenlCatSymbolCurrency = 29,
kUCGenlCatSymbolModifier = 30,
kUCGenlCatSymbolOther = 31
};
Constants
kUCGenlCatOtherNotAssignedCn other; not assigned.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatOtherControlCc other; control.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatOtherFormatCf other; format.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatOtherSurrogateCs other; surrogate.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatOtherPrivateUseCo other; private use.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatMarkNonSpacingMn mark; non-spacing.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatMarkSpacingCombiningMc mark; spacing combining.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatMarkEnclosingMe mark; enclosing.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatNumberDecimalDigitNd number; decimal digit.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatNumberLetterNl number; letter.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatNumberOtherNo number; other.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatSeparatorSpaceZs separator; space.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatSeparatorLineZl separator; Line.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatSeparatorParagraphZp separator; paragraph.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatLetterUppercaseLu Letter; uppercase.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatLetterLowercaseLl Letter; lowercase.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatLetterTitlecaseLt Letter; titlecase.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatLetterModifierLm Letter; modifier.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatLetterOtherLo Letter; other.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatPunctConnectorPc punctuation; connector.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatPunctDashPd punctuation; dash.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatPunctOpenPs punctuation; open.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatPunctClosePe punctuation; close.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatPunctInitialQuotePi punctuation; initial quote.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatPunctFinalQuotePf punctuation; final quote.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatPunctOtherPo punctuation; other.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatSymbolMathSm symbol; math.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatSymbolCurrencySc symbol; currency.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatSymbolModifierSk symbol; modifier.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kUCGenlCatSymbolOtherSo symbol; other.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Unicode Mapping Versions
Specify a Unicode mapping version.
typedef SInt32 UnicodeMapVersion;
enum {
kUnicodeUseLatestMapping = -1,
kUnicodeUseHFSPlusMapping = 4
};
Constants
kUnicodeUseLatestMappingInstead of explicitly specifying the mapping version of the Unicode mapping table to be used for conversion of a text string, you can use this constant to specify that the latest version be used.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.kUnicodeUseHFSPlusMappingIndicates the mapping version used by HFS Plus to convert filenames between Mac OS encodings and Unicode. Only one constant is defined so far for a specific mapping version.
Available in OS X v10.0 and later.
Declared in
UnicodeConverter.h.
Discussion
When performing conversions, you specify the version of the Unicode mapping table to be used for the conversion. You provide the version number in the mapping version field of the structure UnicodeMapping that is passed to a function. A Unicode mapping version is defined by the UnicodeMapVersion data type.
Unwanted Data Constants
Specify data you don’t care about receiving.
enum {
kTextScriptDontCare = -128,
kTextLanguageDontCare = -128,
kTextRegionDontCare = -128
};
Constants
kTextScriptDontCareIndicates that the code is not provided for the derivation.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextLanguageDontCareIndicates that language code is not provided for the derivation.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.kTextRegionDontCareThe region code is not provided for the derivation.
Available in OS X v10.0 and later.
Declared in
TextCommon.h.
Discussion
For backward compatibility with earlier releases of the Mac OS, the Text Encoding Conversion Manager provides the functions UpgradeScriptInfoToTextEncoding and RevertTextEncodingToScriptInfo that you can use to derive Script Manager values from a text encoding or vice versa.
When using these functions, you can specify a Script Manager language code, script code, and/or font values to derive a text encoding. These three constants are defined to allow you to identify any part of the derivation you don’t care about. When reverting from a text encoding to Script Manager values, the Unicode Converter returns these constants for a corresponding value it does not derive: kTextLanguageDontCare, kTextScriptDontCare, and kTextRegionDontCare.
Result Codes
The most common result codes returned by Text Encoding Conversion Manager are listed below.
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-06-02)