Electronic – arduino – How to deal with unicode characters with character LCD displays

arduinodisplay

I would like to buy an LCD screen fom Arduino to display some results from a web http call; the Web API returns a JSON text encoded in UTF-8.

I've read that ICU is the way to go to handle Unicode in C/C++ programs for Arduino.

My questions:
Will I be able to display UTF-8 characters to this kind of screen?
Are there (affordable) character LCD screens able to display UTF-8 characters?

Best Answer

I'm not that much familiar with Arduino, but let's look at it from the LCD perspective.

Virtually all popular character LCDs use HD44780 controller these days (that's what LiquidCrystal library supports). This controller doesn't support UTF-8 directly, each character is represented by a single byte.

Thus you need to convert UTF-8 to 8-bit characters manually. The controller has a built-in character generator with 208 5x8 and 32 5x10 characters, plus up to 8 user-defined characters (see createChar). You need to map every input character to one of the predefined/custom characters - obviously you can only display a subset of UTF8 characters, you need to decide which characters you want/can to display.

The conversion itself should be pretty straightforward - you just need to iterate over the UTF8 string, mapping every character to a single byte. Most likely you'll want to use a lookup tables to keep it simple. Let me know if this needs further explanation.

Related Topic