checkUTF8 function

Check the validity of a byte stream ot be interpreted as UTF8.