ESP8266: Fixing extended ASCII issues in SSD1306 OLED library

I got a few complaints that the esp8266-oled-ssd1306 library does not handle special characters such as Umlauts properly. It turns out that the Arduino IDE does handle characters in the extended ASCII range (from 128-256) as UTF8 characters which means that Strings containing such characters can take more space than the bare number of symbols in it. For instance the degree character (°) will be represented as two chars with values 0xC2 and 0xB0.

Extended ASCII now working properly

Currently the library only supports extended ASCII range and not UTF8. I don’t know if I will ever support UTF8, so I introduced automatic detection and conversion for characters in the extended ASCII table. This should work transparently for the users of the library. The implementation has currently one ugly aspect: if you call the getStringWidth(..) method followed by drawString(..) the conversion will be made twice.

I released the new version 1.0.2 of the library and it should become available in the Arduino IDE library manager shortly for update.

If you want to read more about UTF8 in the Arduino IDE continue here:
http://playground.arduino.cc/Code/UTF-8

Now a beer! Did you like this post? It often takes me several hours of my free time to write one. If I was your neighbour would you offer me a beer for the hard work I did for you? The beauty is: beers can be teletransported with a painless donation using Paypal. A beer in a Swiss bar costs about USD $4.80. Or use this affiliate link if you order something on Banggood and I'll get a small kickback. Thank you!
Related:  ESP8266: Wifi data logger already running for more than 2 months on batteries!