ns_valid_utf8 - Check whether the provided byte-array contains a valid UTF-8 byte sequence
This function checks whether the provided argument (a Tcl byte-array) contains a valid UTF-8 code). The function returns a boolean result. When the optional varname is specified, a variable with this name is set in failure cases to the invalid part of the input string.
Note that this function only makes sense when applied on binary data, typically read from a socket or a file.
% ns_valid_utf8 motörhead 1 % ns_valid_utf8 "foo\x85" 0 % ns_valid_utf8 mot\x85rhead errorString 0 % set errorString mot|\x85r|...