OLED utf-8 question

I have this SBC OLED screen, and from my photon device I want to write utf-8 strings with special characters like é, ö, etc. to it, but instead it displays two single nonsense-characters. I am using the adafruit ssd1306 library.
Ideas, anyone?

Most of the fonts in Adafruit GFX, which is the font and graphics rendering engine used with the Adafruit SSD1306 library, only support 7-bit ASCII.

The TomThumb font does have ISO-8859-1, so you can get the accented characters if you include that font like this:

#define TOMTHUMB_USE_EXTENDED 1
#include "TomThumb.h"

and the font in your code:

display.setFont(&TomThumb);

Replace display with the variable you used for your SSD1306 display.

Use the ISO-8859-1 8-bit code point, not UTF-8, of course.

The entire Unicode character set is far too large to fit the font bitmaps for every Unicode character in the flash available on a Particle device.

2 Likes

Thank you Rick. My OLED does already display characters of the extended ASCII using the standard library, that is not the issue. The question is: how do I translate 16 bits UTF-8 characters to 8 bit extended ASCII? I want to display a text that is delivered by a web service in UTF-8.
Is there a library that does that for me?

I solved my problem using a modified version of GitHub - TechnoPhysCAL/TGP_Ecran: La librairie TGP_Ecran pour Arduino, permet de contrôler un affichage de type OLED.. They provide a UTF-8 to extended ASCII routine.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.