,figuerres wrote

reading a char may or may not be the same as reading a byte if the file is saved as unicode.

Well that's why you read the first two or three bytes and look for a byte order mark