---
title: CreateTextToUnicodeInfoByEncoding
framework: Core Services
role: symbol
role_heading: Function
platforms: [macOS 10.0+]
path: coreservices/1433560-createtexttounicodeinfobyencodin
---

# CreateTextToUnicodeInfoByEncoding

Based on the given text encoding specification, createsand returns a Unicode converter object containing information requiredfor converting strings from the specified non-Unicode encoding toUnicode.

## Declaration

```occ
OSStatus CreateTextToUnicodeInfoByEncoding(TextEncoding iEncoding, TextToUnicodeInfo *oTextToUnicodeInfo);
```

## Parameters

- `iEncoding`: The text encoding specification for the source text.
- `oTextToUnicodeInfo`: The Unicode converter object of type doc://com.apple.documentation/documentation/coreservices/texttounicodeinfo returned by the function.

## Return Value

Return Value A resultcode. See Result Codes.

## Discussion

Discussion You can use this function instead of the  CreateTextToUnicodeInfo  function whenyou do not need to create a Unicode mapping structure. You simplyspecify the text encoding of the source text. However, this methodis less efficient because the text encoding parameter must be resolvedinternally into a Unicode mapping.  You cannot specify a version of Unicode. The function usesa 16-bit form of Unicode as the default. You pass a Unicode converter object returned from CreateTextToUnicodeInfoByEncoding to thefunction  ConvertFromTextToUnicode or  ConvertFromPStringToUnicode to identify the information to be used for the conversion. Thesetwo functions modify the contents of the Unicode converter object.  You pass a Unicode converter object returned from CreateTextToUnicodeInfoByEncoding to thefunction  TruncateForTextToUnicode to identify the information to be used to truncate the string. Thisfunction does not modify the contents of the Unicode converter object. If you are converting the text stream to Unicode as an intermediaryencoding, 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.

## See Also

### Converting to Unicode

- [ChangeTextToUnicodeInfo](coreservices/1433487-changetexttounicodeinfo.md)
- [ConvertFromTextToUnicode](coreservices/1433517-convertfromtexttounicode.md)
- [CreateTextToUnicodeInfo](coreservices/1433598-createtexttounicodeinfo.md)
- [DisposeTextToUnicodeInfo](coreservices/1433669-disposetexttounicodeinfo.md)
- [ResetTextToUnicodeInfo](coreservices/1433526-resettexttounicodeinfo.md)
