Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Up Previous Next 

PATH 
Mac OS 8 and 9 Developer Documentation > Text Encoding Conversion Manager
Programming With the Text Encoding Conversion Manager



CreateUnicodeToTextRunInfo

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.

pascal OSStatus CreateUnicodeToTextRunInfo (
                     ItemCount iNumberOfMappings,
                     const UnicodeMapping iUnicodeMappings[],
                     UnicodeToTextRunInfo *oUnicodeToTextInfo);
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 the iEncodings parameter 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 of kUnicode16BitFormat or kUnicodeUTF8Format. Note that the versions of the Unicode Converter prior to the Text Encoding Conversion Manager 1.2.1 do not support kUnicodeUTF8Format. Also, note that the unicodeEncoding field should be the same for all of the entries in iUnicodeMappings. If you pass NULL for the iUnicodeMappings parameter, 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 and ScriptOrder('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 output, a Unicode converter object that holds the mapping table information you supply as the iUnicodeMappings parameter and the state information related to the conversion.

function result
A result code. In addition to various resource and memory errors, the function can return the following result codes:

kTextUnsupportedEncodingErr One of the encodings specified by the Unicode mapping structure you supply is not currently supported.

kTECMissingTableErr A resource associated with one of the encodings is missing.

kTECTableChecksumErr A resource has an invalid checksum, indicating that it has become corrupted.

If an error is returned, the Unicode converter object is invalid. See Text Encoding Conversion Manager Result Codes in the chapter Basic Text Types Reference for other possible result code values.

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.

SEE ALSO

The function CreateUnicodeToTextInfoByEncoding

The function CreateUnicodeToTextRunInfoByScriptCode


© 1999 Apple Computer, Inc. – (Last Updated 13 Dec 99)

Up Previous Next