Espalexa icon indicating copy to clipboard operation
Espalexa copied to clipboard

[Found and solution proposed] Byte Order Mark in Espalexa.h preventing it to compile in some cases

Open shimo97 opened this issue 1 year ago • 3 comments

I was experiencing a strange bug by trying to compile the library from the local project folder, the compiler wasn't recognizing the #ifndef Espalexa_h at the beginning of Espalexa.h, after running an hexdump on the file i found out that there are three corrupted bytes (EF BB BF) at the beginning of the file: image

(EDIT: those characters seem to be UTF-8 Byte Order Mark characters)

Those characters were recognized as a special unicode charcter an the #ifndef was not seen by the compiler.

This is subtle because for some reasons the library works perfectly if included from the Arduino libraries folder but instead it doesn't work if the code is copied and included from the sketch folder or other locations.

After removing those corrupted characters everything works fine.

shimo97 avatar Feb 24 '24 17:02 shimo97

That's a BOM. See here https://en.m.wikipedia.org/wiki/Byte_order_mark Strange though that it works in one place but not in the other.

HHHartmann avatar Feb 25 '24 09:02 HHHartmann

Thanks! I didn't know that, that makes more sense now. Yes, i really don't understand why it doesn't compile in local folder but it compiles from library folder, but i tried both with 1.x and 2.x ide and neither worked, i don't know if you were also able to replicate the error... I found someone having the same problem here, and there's also a solution posted to change the file encoding to remove those

shimo97 avatar Feb 25 '24 13:02 shimo97

I edited the issue to include your informations

shimo97 avatar Feb 25 '24 14:02 shimo97