*

ingar

  • *
  • 22
    • View Profile
    • Label Printing Software & Solutions
TGUI and Unicode
« on: 07 May 2019, 21:53:12 »
Hi all,

A general question:

Are there any ways of supporting Unicode in TGUI? I am hoping to be able to replace a Windows CE application with a TGUI app. But the Windows CE app is connecting to a server that returns UTF8 data.
And I cannot see how to TGUI can display those Japanese names...

Ingar


*

texus

  • *****
  • 1365
    • View Profile
    • Texus's Blog
Re: TGUI and Unicode
« Reply #1 on: 07 May 2019, 22:30:39 »
TGUI uses sf::String on most places, which supports unicode, you just need to get the data into sf::String. If your data is UTF8 and stored in some array of "char" or "unsigned char", you should be able to use sf::String::fromUtf8(data.begin(), data.end()).

If you want to display special characters then you need to make sure to use a font that can render those characters. Maybe the default TGUI font can, but it is possible that it will just render squares in which case you need a different font.