Important: The information in this document is obsolete and should not be used for new development.
It may not be possible to convert a Unicode string to a single destination encoding. To handle these cases, the Unicode Converter provides a function that allows you to specify a number of possible destination encodings and how the function should use these destination encodings, if necessary, when converting the Unicode string. Before you can use the function ConvertFromUnicodeToTextRun for this purpose, you must first create and obtain a Unicode converter object containing the mapping and state information the Unicode Converter uses to perform the conversion. You use the function CreateUnicodeToTextRunInfo CreateUnicodeToTextRunInfoByEncoding, or CreateUnicodeToTextRunInfoByScriptCode for this purpose. You then pass the object to the ConvertUnicodeToTextRun function to perform the conversion. You can also convert a Unicode string to one or more scripts. For this purpose you use the function ConvertFromUnicodeToScriptCodeRun.
You can use the same Unicode converter object to convert multiple Unicode strings belonging to the same text stream to the encodings specified in the mapping table.
If you use the same Unicode converter object to convert multiple Unicode strings, you should set the keep-information control flag when you call the conversion function. This is because how the conversion is performed might depend on the previous segment. The Unicode Converter might need to refer to the direction state from the previous segment--for example, to determine the text direction for Hebrew or Arabic text.
You should use the same Unicode converter object only to convert the text stream for which you created the Unicode converter object. This is because the Unicode Converter stores private state information in a Unicode converter object that is relevant only to the single text stream for which it is used.
When you are finished converting all of the text reliant on the Unicode converter object, release the memory allocated for the Unicode converter object by calling the function DisposeUnicodeToTextRunInfo.