12.4.4.4 Wide-character versions
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Foreign Language Interface
        • The Foreign Include File
          • Analysing Terms via the Foreign Interface
            • Wide-character versions
              • PL_new_atom_wchars()
              • PL_atom_wchars()
              • PL_get_wchars()
              • PL_put_wchars()
              • PL_unify_wchars()
              • PL_unify_wchars_diff()
              • PL_utf8_code_point()
              • PL_utf8_strlen()
              • PL_wcwidth()
              • PL_is_id_start()
              • PL_is_id_continue()
              • PL_is_uppercase()
              • PL_is_decimal()
              • PL_is_layout()
              • PL_ctype_flags()
              • PL_toupper()
              • PL_tolower()
              • PL_totitle()
    • Packages
Availability:C-language interface function
int PL_utf8_code_point(const char **in, const char *end, int *cp)
Decode the UTF-8 sequence at in into the code point cp and advance in past it. The sequence ends before end. If end is NULL, the input is a 0-terminated string: the decoder never reads past the 0-byte. Returns the number of bytes consumed, or -1 if the sequence is invalid. Only the shortest encoding of a code point up to U+10FFFF is valid. An invalid sequence consumes one byte and returns that byte in cp, except for a surrogate (U+D800 ... U+DFFF), which consumes the sequence and returns U+FFFD. This is the decoder Prolog uses for UTF-8 text, so foreign code using it agrees with Prolog on, e.g., the number of characters in invalid UTF-8. ASCII is decoded inline.