OpenersNotesSection(Spacer1)Details

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

WSGetUTF8Symbol() returns immutable data.

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

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

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

WSGetUTF8Symbol() is declared in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "wstp.h"

/* read an UTF-8 encoded symbol from a link */

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

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

	/* ... */

	WSReleaseUTF8Symbol(lp, symbol, bytes);
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSGetSymbol(), paclet:ref/c/WSGetSymbol])  ▪  (NonWLLink[WSGetByteSymbol(), paclet:ref/c/WSGetByteSymbol])  ▪  (NonWLLink[WSGetUCS2Symbol(), paclet:ref/c/WSGetUCS2Symbol])  ▪  (NonWLLink[WSGetUTF16Symbol(), paclet:ref/c/WSGetUTF16Symbol])  ▪  (NonWLLink[WSGetUTF32Symbol(), paclet:ref/c/WSGetUTF32Symbol])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}})}})