[Found and solution proposed] Byte Order Mark in Espalexa.h preventing it to compile in some cases
Opened this issue · 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:
(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.
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.
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
I edited the issue to include your informations