The code reads 80 bytes from the file and tries to determines if it is a UTF-8 encoded... And don't know how to do it, but there is a simple and easy way to check if the same text isn't in ASCII.
If you search for the ASCII table, you will realize that all values are in the range starting from 0 to 127. So, you may do something like this:
for (i = 0 ; i < 80 ; i++)
if ((unsigned char)string[i] >= 0x80)
May this help you...