Important: The information in this document is obsolete and should not be used for new development.
Converts text in the source encoding to runs of text in multiple destination encodings.
pascal OSStatus TECConvertTextToMultipleEncodings(
The TECConvertTextToMultipleEncodings function converts the stream of text you pass it to runs of destination encodings specified in the converter object. The function relies on the specified converter object for the source encoding in which the text is expressed, the destination encodings, and the train of encodings forming the intermediate conversion path (if one is explicitly specified). The function returns the text in the output buffer that you provide.
In allocating an output buffer, a good rule of thumb is larger is better, basing your estimate on the byte requirements of the destination encoding. You should always allocate a buffer at least 32 bytes long. For the function to return successfully, the output buffer you allocate must be large enough to accommodate at least part of the converted text. Then, if the function cannot convert all of the text, it executes successfully, returns the portion of the text it converted, and returns the number of source bytes it removed from input in the actualInputLength parameter. You can use this number 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 output buffer you allocate is too small to accommodate any of the converted text, the function fails. For example, if the destination encoding requires bytes in addition to the actual text (for instance, an escape sequence preceding the converted text), your buffer must be large enough to accommodate both.
IMPORTANT
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.
The Text Encoding Converter creates internal buffers for all multistaged (that is, indirect) conversions that hold intermediate results.
The function TECConvertText