diff --git a/src/screen.h b/src/screen.h index f5f4b3c9..47860275 100644 --- a/src/screen.h +++ b/src/screen.h @@ -154,9 +154,11 @@ class Screen : public PeriodicTask // UTF-8 to font table index converter // Code form http://playground.arduino.cc/Main/Utf8ascii static uint8_t LASTCHAR; + static bool SKIPREST; // Only display a single unconvertable-character symbol per sequence of unconvertable characters if (ch < 128) { // Standard ASCII-set 0..0x7F handling LASTCHAR = 0; + SKIPREST = false; return ch; } @@ -164,12 +166,15 @@ class Screen : public PeriodicTask LASTCHAR = ch; switch (last) { // conversion depnding on first UTF8-character - case 0xC2: return (uint8_t) ch; - case 0xC3: return (uint8_t) (ch | 0xC0); - case 0x82: if (ch == 0xAC) return (uint8_t) 0x80; // special case Euro-symbol + case 0xC2: { SKIPREST = false; return (uint8_t) ch; } + case 0xC3: { SKIPREST = false; return (uint8_t) (ch | 0xC0); } + case 0x82: { SKIPREST = false; if (ch == 0xAC) return (uint8_t) 0x80; } // special case Euro-symbol } + // If we already returned an unconvertable-character symbol for this unconvertable-character sequence, return NULs for the rest of it + if (SKIPREST) return (uint8_t) 0; + SKIPREST = true; - return (uint8_t) '?'; // otherwise: return ?, if character can't be converted + return (uint8_t) 0xA8; // otherwise: return ¿ if character can't be converted } /// Returns a handle to the DebugInfo screen.