Doing some encoding tests, I saved a c-file with encoding 'UTF-16 LE' (using sublimeText).
The c file contains the following:
#include <stdio.h>
void main() {
char* letter = "é";
printf("%s\n", letter);
}
Compiling this file with gcc returns the error:
test.c:1:3: error: invalid preprocessing directive #i; did you mean #if?
1 | # i n c l u d e < s t d i o . h >
It's as if gcc
inserted a space before each character when reading the c-file.
My question is: Can we submit c-files encoded in some format other than "utf-8" ? Why it was not possible for gcc to detect the encoding of my file and read it properly ?