Contents

ConvertFromUnicodeToPString

Converts a Unicode string to Pascal in a Mac OS text encoding.

Declaration

OSStatus ConvertFromUnicodeToPString(UnicodeToTextInfo iUnicodeToTextInfo, ByteCount iUnicodeLen, const UniChar iUnicodeStr[], Str255 oPascalStr);

Parameters

  • iUnicodeToTextInfo:

    A Unicode converter object. You use the CreateUnicodeToTextInfo or CreateUnicodeToTextInfoByEncoding function 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 iUnicodeStr parameter.

  • 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 resultcode. See Result Codes.

Discussion

The ConvertFromUnicodeToPString functionprovides an easy and efficient way to convert a Unicode string toa Pascal string in a Mac OS text encoding without incurring the overheadassociated with use of the function ConvertFromUnicodeToText or ConvertFromUnicodeToScriptCodeRun.

If necessary, this function uses the loose mapping and fallbackcharacters to map the text elements of the string. For fallbackmappings, it uses the handler associated with the Unicode converterobject.

See Also

Converting Between Unicode and Pascal Strings