"Paul Chitescu" paulc@voip.null.ro wrote:
/* Attempt to guess the encoding from the first several bytes */
if (encoding < 0) {
if (line [0] == '\377' && line [1] == '\376') {
encoding = 2; /* FF FE => UCS-2 little endian */
offset = 2;
}
else if (line [0] == '\357' && line [1] == '\277' && line [2] == '\275') {
encoding = 1; /* EF BF BD => UTF-8 */
offset = 3;
if (line [3] == '\357' && line [4] == '\277' && line [5] == '\275')
offset += 3;
}
else
encoding = 0; /* default => ASCII (hope so...) */
That's quite confising to use hex numbers in the comments and not use them in actual comparisons.