EFUNs: Rewrite of validate_utf8(). Changed validation approach in validate_utf8() to simplify the code, and make it easier to read/understand. Also adds some corresponding testsuite tests.