OpenersNotesSection(Spacer1)Details

MLGetUTF16Symbol() allocates memory for the character string. You must call (NonWLLink[MLReleaseUTF16Symbol(), paclet:ref/c/MLReleaseUTF16Symbol]) to disown this memory. If MLGetUTF16Symbol() fails and the function's return value indicates an error, do not call (NonWLLink[MLReleaseUTF16Symbol(), paclet:ref/c/MLReleaseUTF16Symbol]) on the contents of s.

MLGetUTF16Symbol() returns immutable data.

MLGetUTF16Symbol() stores all characters directly in the UTF-16 Unicode encoding form.

The symbol s returned by MLGetUTF16Symbol() begins with a byte order mark.

The length of the symbol n includes the byte order mark.

MLGetUTF16Symbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.

Use (NonWLLink[MLError(), paclet:ref/c/MLError]) to retrieve the error code if MLGetUTF16Symbol() fails.

MLGetUTF16Symbol() is declared in the MathLink header file (RefLink[mathlink.h, paclet:ref/file/mathlink.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "mathlink.h"

/* read a UTF-16 symbol from a link */

void f(MLINK lp)
{
	const unsigned short *symbol;
	int length;
	int characters;

	if(! MLGetUTF16Symbol(lp, &symbol, &length, &characters))
		{
			/* unable to read the UTF-16 symbol from lp */
			return;
		}

	/* ... */

	MLReleaseUTF16Symbol(lp, symbol, length, characters);
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLGetSymbol(), paclet:ref/c/MLGetSymbol])  ▪  (NonWLLink[MLGetUCS2Symbol(), paclet:ref/c/MLGetUCS2Symbol])  ▪  (NonWLLink[MLGetUTF8Symbol(), paclet:ref/c/MLGetUTF8Symbol])  ▪  (NonWLLink[MLGetUTF32Symbol(), paclet:ref/c/MLGetUTF32Symbol])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}, {▪(RefLinkPlain[Handling Lists, Arrays and Other Expressions, paclet:tutorial/HandlingListsArraysAndOtherExpressions])}})}})