Extended ASCII in Header File

Hi everyone!

I'm having problem with strings in Header Files. I split my project into multiple Header Files in the same folder of the Sketch (with one .cpp files in sketch folder, I have problems), those header files are just part of the code included in the .ino, and I would like to keep it separated.

As I'm using Extended ASCII characters in the strings, for example:

Configurações

I have this line in preferences.txt of Arduino:

preproc.substitute_unicode=false

If I use this string in the .ino file, I get no problem at printing and drawing, as each Extented ASCII are correct (one byte).

BUT using it in header files, I get this printing it:

Configurações

Because, I think, the Extended ASCII are being replaced by UNICODE (two bytes rather than one of ASCII).

Is there a way to solve it, to make it stop replacing by UNICODE?

Sincerely,
User

Which editor did you last use to change the header files?

I've used Notepad++.

That is very likely the culprit. Notepad++ is probably treating the files as UTF-8 instead of "no encoding" / "raw".

What is receiving / interpreting the strings? An LCD display?

Printing in a TFT display shows the same problem:

Configurações

rather than:

Configurações

I will try other codifications, like ANSI.

giova014:
Printing in a TFT display shows the same problem:

Configurações

rather than:

Configurações

I will try other codifications, like ANSI.

The problem is that ASCII (sometimes incorrectly called "ANSI") does not have those "extended" characters. Some 8-bit character sets, such as ISO8859-1 and Windows-1252, do have those characters. Try using one of those encodings if they're available.

I've tried all the codifications, but no positive result.

My solution for now is writing:

"Configurações"

as:

"Configura\xE7\xF5es"

or even:

{'C','o','n','f','i','g','u','r','a',231,245,'e','s'}

In the last case I think it's suitable using with a macro (considerating memory for the '\0').

Thanks for all the help!