OpenersNotesSection(Spacer1)Details

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

MLGetUTF8Symbol() returns immutable data.

MLGetUTF8Symbol() stores all characters directly in the UTF-8 Unicode encoding form.

MLGetUTF8Symbol() 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 MLGetUTF8Symbol() fails.

MLGetUTF8Symbol() 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 an UTF-8 encoded symbol from a link */

void f(MLINK lp)
{
	const unsigned char *symbol;
	int bytes;
	int characters;

	if(! MLGetUTF8Symbol(lp, &symbol, &bytes, &characters))
		{
			/* unable to read the UTF-8 symbol from lp */
			return;
		}

	/* ... */

	MLReleaseUTF8Symbol(lp, symbol, bytes);
}

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