validate


Description:

[ CCode ( cname = "g_utf8_validate" ) ]
public bool validate (ssize_t max_len = -1, out char* end = null)

Validates UTF-8 encoded text.

str is the text to validate; if str is nul-terminated, then max_len can be -1, otherwise max_len should be the number of bytes to validate. If end is non-null, then the end of the valid range will be stored there (i.e. the start of the first invalid character if some bytes were invalid, or the end of the text being validated otherwise).

Note that validate returns false if max_len is positive and any of the max_len bytes are nul.

Returns true if all of str was valid. Many GLib and GTK+ routines require valid UTF-8 as input; so data read from a file or the network should be checked with validate before doing anything else with it.

Parameters:

max_len

max bytes to validate, or -1 to go until NUL

end

return location for end of valid data

str

a pointer to character data

Returns:

true if the text was valid UTF-8