This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
MathLink C Function


int MLGetUTF8Symbol(MLINK link, const unsigned char **s, int *b, int *c)
gets a UTF-8 encoded character string corresponding to the name of a symbol from the MathLink connection specified by link, storing the result in s, the number of bytes in the string in b, and the number of characters in the string in c.
  • MLGetUTF8Symbol() allocates memory for the character string. You must call MLReleaseUTF8Symbol() to disown this memory. If MLGetUTF8Symbol() fails and the function's return value indicates an error, do not call 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 MLError() to retrieve the error code if MLGetUTF8Symbol() fails.
  • MLGetUTF8Symbol() is declared in the MathLink header file mathlink.h.
#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 */

    /* ... */

    MLReleaseUTF8Symbol(lp, symbol, bytes, characters);