Danish chars on MCUFRIEND TFT with Adafruit_GFX

I usea 2.4" MCUFRIEND TFT, and everything word OK, but when I use danish chars, they are wrong on the TFT, see the picture!

My code is:

#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

// Color definitions - in 5:6:5
#define BLACK 0x0000
#define WHITE 0xFFFF

const int XP = 6, XM = A2, YP = A1, YM = 7; //ID=0x9341 m. 2.4" rød pw

void setup() {
uint16_t ID = tft.readID();
tft.begin(ID);
tft.setRotation(3);
tft.fillScreen(BLACK);
tft.setTextColor(WHITE);
tft.setTextSize(3);
tft.setCursor(13, 80);
tft.println( “æ ø å”);
tft.print();
tft.print(" Æ Ø Å");
}

void loop() {
}

Is it possible to upload specialchars to the program?

Hi.

Did you use the search function of this forum ?
Try something like this

Computer programs were originally designed for US / English text. ASCII is only defined for 0 - 127.
If you want anything else you have to go to Unicode which requires uint16_t per character.

Most microcontrollers can’t afford monster Unicode fonts or even using uint16_t for each letter.

However an easy trick is to use uint8_t with a 256-char font.
Your 16x2 LCD has some random graphics in the non-printable slots e.g. 0-31, 128-255
Likewise the Adafruit_GFX “7x5 system font” has some equally random graphic characters.

The “FreeFonts” that come with Adafruit_GFX only contain printable ASCII i.e. 32-126
The GFX code will happily print 32-255 if you create a full-fat FreeFont.

Of course " Æ Ø Å" and “æ ø å” can be found in Unicode 128-255 range. But I bet that some other Danish characters are only available in the Unicode 256-65535 range.

If you want to use the random characters in the system font you have to embed the letter as an escape e.g. “x92” for “Æ”

If you want your source code to look “readable” you can just use UTF8 encoding with a library that can understand UTF8 e.g. Olikraus’s “U8g2_for_Adafruit_GFX.h”
This lets you use ANY of Olikraus’s fonts in any size with any Adafruit_GFX style library like MCUFRIEND_kbv

    u8g2_for_adafruit_gfx.setFont(u8g2_font_helvR14_tf);  // select u8g2 font from here: https://github.com/olikraus/u8g2/wiki/fntlistall
    u8g2_for_adafruit_gfx.setFontMode(1);                 // use u8g2 transparent mode (this is default)
    u8g2_for_adafruit_gfx.setFontDirection(0);            // left to right (this is default)
    u8g2_for_adafruit_gfx.setForegroundColor(TFT_WHITE);  // apply Adafruit GFX color
    u8g2_for_adafruit_gfx.setCursor(0, 20);               // start writing at this position
    u8g2_for_adafruit_gfx.print("Hello World");
    u8g2_for_adafruit_gfx.setCursor(0, 40);               // start writing at this position
    u8g2_for_adafruit_gfx.print("Umlaut ÄÖÜ");            // UTF-8 string with german umlaut chars
    u8g2_for_adafruit_gfx.setCursor(0, 60);
    u8g2_for_adafruit_gfx.print("<μȦǀʘxB5xA3ʁμπ>");

Big fonts become expensive on a Uno. No problem on a Zero or Due.

David.

MAS3:
Yes, I have tryed to find a solution for more days, and found a lot of proposal but nothing I can use!

David:
I don't use LCD 162 or LCD 164 as you can see from the picture, but I used it before and also making the Danish chars.
I will try to install the ug82 lib.

Thank you both for the help!