-->
Page 1 of 1

Write Latin characters to file (SPIFFS, LittleFS)

PostPosted: Thu Nov 18, 2021 6:07 pm
by seedseifer
Hey guys,
I'm trying to write text to file but when there are special characters they look strange, example below:

On code "TESTING SPECIAL CHAR Ç É ção normal é e."
On file "TESTING SPECIAL CHAR Ç É ção normal é e."

Part of code bellow:

Code: Select allString bootout;
bool fsmount = LittleFS.begin();
  if (fsmount) {
    bootlog = true;
    bootout = "TESTING SPECIAL CHAR Ç É ção normal é e.";
    File f = LittleFS.open("bootlog.txt", "w");
    if (f) {
      f.println(bootout);
      f.close();
    }
  }


Both with String and with char[] the problem happens.

Interesting fact, if I use the arduinojson lib to serialize directly into the file the characters come out correctly.

this is driving me crazy... :?
Has anyone ever experienced this?

Re: Write Latin characters to file (SPIFFS, LittleFS)

PostPosted: Fri Nov 19, 2021 1:00 am
by JurajA
it is because your source code editor uses UTF

Re: Write Latin characters to file (SPIFFS, LittleFS)

PostPosted: Sat Nov 20, 2021 8:37 pm
by QuickFix
Always a nice topic: ANSI vs Unicode :idea: